Reproducing a web page and add own content to it.

Discussion in 'Python' started by LaundroMat, Apr 8, 2008.

  1. LaundroMat

    LaundroMat Guest

    Hi -

    I'm working on a Django powered site where one of the required
    functionalities is the possibility of displaying the content of
    external pages, with an extra banner at the top where specific
    information is displayed. In other words, I'm looking for a way to
    reproduce an existing web page and add some HTML code to it. (I can't
    think of an example right now, but the idea is similar to sites that
    let you see an external page and have some site-specific text above it
    (often stating that the content below is not part of the site the user
    comes from)).

    To test this, I've been downloading an external page, adding some text
    to it and re-opening it in a browser (with the help of built-in
    modules such as urllib2 etc). This works of course, but the external
    page's links such as <img src="hello.png">, or <a href="help.html">
    are evidently no longer correct.

    Apart from parsing the whole file and trying to inject the external
    site's domain in links such as the above (with the added inconvenience
    of having to store the external page locally), is there an easier way
    of accomplishing what I want?

    Thanks,

    Mathieu
    LaundroMat, Apr 8, 2008
    #1
    1. Advertising

  2. LaundroMat wrote:

    > Hi -
    >
    > I'm working on a Django powered site where one of the required
    > functionalities is the possibility of displaying the content of
    > external pages, with an extra banner at the top where specific
    > information is displayed. In other words, I'm looking for a way to
    > reproduce an existing web page and add some HTML code to it. (I can't
    > think of an example right now, but the idea is similar to sites that
    > let you see an external page and have some site-specific text above it
    > (often stating that the content below is not part of the site the user
    > comes from)).
    >
    > To test this, I've been downloading an external page, adding some text
    > to it and re-opening it in a browser (with the help of built-in
    > modules such as urllib2 etc). This works of course, but the external
    > page's links such as <img src="hello.png">, or <a href="help.html">
    > are evidently no longer correct.
    >
    > Apart from parsing the whole file and trying to inject the external
    > site's domain in links such as the above (with the added inconvenience
    > of having to store the external page locally), is there an easier way
    > of accomplishing what I want?


    Using a frame?

    Diez
    Diez B. Roggisch, Apr 8, 2008
    #2
    1. Advertising

  3. LaundroMat

    LaundroMat Guest

    On Apr 8, 2:04 pm, "Diez B. Roggisch" <> wrote:
    > LaundroMat wrote:
    > > Hi -

    >
    > > I'm working on a Django powered site where one of the required
    > > functionalities is the possibility of displaying the content of
    > > external pages, with an extra banner at the top where specific
    > > information is displayed. In other words, I'm looking for a way to
    > > reproduce an existing web page and add some HTML code to it. (I can't
    > > think of an example right now, but the idea is similar to sites that
    > > let you see an external page and have some site-specific text above it
    > > (often stating that the content below is not part of the site the user
    > > comes from)).

    >
    > > To test this, I've been downloading an external page, adding some text
    > > to it and re-opening it in a browser (with the help of built-in
    > > modules such as urllib2 etc). This works of course, but the external
    > > page's links such as <img src="hello.png">, or <a href="help.html">
    > > are evidently no longer correct.

    >
    > > Apart from parsing the whole file and trying to inject the external
    > > site's domain in links such as the above (with the added inconvenience
    > > of having to store the external page locally), is there an easier way
    > > of accomplishing what I want?

    >
    > Using a frame?
    >
    > Diez


    Ack. I was too focused on importing the external web page and
    redisplaying the information (I've just been reading up on
    BeautifulSoup) instead of looking for an HTML based approach.

    Thanks!
    LaundroMat, Apr 8, 2008
    #3
  4. LaundroMat

    Steve Holden Guest

    LaundroMat wrote:
    > On Apr 8, 2:04 pm, "Diez B. Roggisch" <> wrote:
    >> LaundroMat wrote:
    >>> Hi -
    >>> I'm working on a Django powered site where one of the required
    >>> functionalities is the possibility of displaying the content of
    >>> external pages, with an extra banner at the top where specific
    >>> information is displayed. In other words, I'm looking for a way to
    >>> reproduce an existing web page and add some HTML code to it. (I can't
    >>> think of an example right now, but the idea is similar to sites that
    >>> let you see an external page and have some site-specific text above it
    >>> (often stating that the content below is not part of the site the user
    >>> comes from)).
    >>> To test this, I've been downloading an external page, adding some text
    >>> to it and re-opening it in a browser (with the help of built-in
    >>> modules such as urllib2 etc). This works of course, but the external
    >>> page's links such as <img src="hello.png">, or <a href="help.html">
    >>> are evidently no longer correct.
    >>> Apart from parsing the whole file and trying to inject the external
    >>> site's domain in links such as the above (with the added inconvenience
    >>> of having to store the external page locally), is there an easier way
    >>> of accomplishing what I want?

    >> Using a frame?
    >>
    >> Diez

    >
    > Ack. I was too focused on importing the external web page and
    > redisplaying the information (I've just been reading up on
    > BeautifulSoup) instead of looking for an HTML based approach.
    >
    > Thanks!


    You could also look at adding a <base> tag to your generated page's
    <head> section.

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    Holden Web LLC http://www.holdenweb.com/
    Steve Holden, Apr 8, 2008
    #4
  5. LaundroMat

    LaundroMat Guest

    On Apr 8, 4:11 pm, Steve Holden <> wrote:
    > LaundroMat wrote:
    > > On Apr 8, 2:04 pm, "Diez B. Roggisch" <> wrote:
    > >> LaundroMat wrote:
    > >>> Hi -
    > >>> I'm working on a Django powered site where one of the required
    > >>> functionalities is the possibility of displaying the content of
    > >>> external pages, with an extra banner at the top where specific
    > >>> information is displayed. In other words, I'm looking for a way to
    > >>> reproduce an existing web page and add some HTML code to it. (I can't
    > >>> think of an example right now, but the idea is similar to sites that
    > >>> let you see an external page and have some site-specific text above it
    > >>> (often stating that the content below is not part of the site the user
    > >>> comes from)).
    > >>> To test this, I've been downloading an external page, adding some text
    > >>> to it and re-opening it in a browser (with the help of built-in
    > >>> modules such as urllib2 etc). This works of course, but the external
    > >>> page's links such as <img src="hello.png">, or <a href="help.html">
    > >>> are evidently no longer correct.
    > >>> Apart from parsing the whole file and trying to inject the external
    > >>> site's domain in links such as the above (with the added inconvenience
    > >>> of having to store the external page locally), is there an easier way
    > >>> of accomplishing what I want?
    > >> Using a frame?

    >
    > >> Diez

    >
    > > Ack. I was too focused on importing the external web page and
    > > redisplaying the information (I've just been reading up on
    > > BeautifulSoup) instead of looking for an HTML based approach.

    >
    > > Thanks!

    >
    > You could also look at adding a <base> tag to your generated page's
    > <head> section.
    >
    > regards
    > Steve
    > --
    > Steve Holden +1 571 484 6266 +1 800 494 3119
    > Holden Web LLC http://www.holdenweb.com/


    True, but I suppose that users would no longer see the top banner
    added by me when they click on one of the links on the external site's
    page. I'm a bit hesitant about using frames however, but reading up on
    them makes me think the application I have in mind for them might be
    the generally accepted exception to the rule that frames are bad :)

    Anyway. Thanks for the help!
    LaundroMat, Apr 8, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    0
    Views:
    607
  2. Oreo

    Reproducing du/ls in Java

    Oreo, Nov 29, 2004, in forum: Java
    Replies:
    5
    Views:
    1,185
  3. Sweety

    Is any self reproducing code in C ?

    Sweety, Aug 23, 2004, in forum: C Programming
    Replies:
    6
    Views:
    398
    bogonic
    Aug 26, 2004
  4. Replies:
    11
    Views:
    721
    Tor Rustad
    May 18, 2007
  5. jimgardener

    reproducing c function in java

    jimgardener, Jun 26, 2008, in forum: Java
    Replies:
    3
    Views:
    315
    Arne Vajhøj
    Jun 26, 2008
Loading...

Share This Page