Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Reproducing a web page and add own content to it.

Reply
Thread Tools

Reproducing a web page and add own content to it.

 
 
LaundroMat
Guest
Posts: n/a
 
      04-08-2008
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

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      04-08-2008
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
 
Reply With Quote
 
 
 
 
LaundroMat
Guest
Posts: n/a
 
      04-08-2008
On Apr 8, 2:04 pm, "Diez B. Roggisch" <de...@nospam.web.de> 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!
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      04-08-2008
LaundroMat wrote:
> On Apr 8, 2:04 pm, "Diez B. Roggisch" <de...@nospam.web.de> 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/

 
Reply With Quote
 
LaundroMat
Guest
Posts: n/a
 
      04-08-2008
On Apr 8, 4:11 pm, Steve Holden <st...@holdenweb.com> wrote:
> LaundroMat wrote:
> > On Apr 8, 2:04 pm, "Diez B. Roggisch" <de...@nospam.web.de> 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Trouble Reproducing the Color Purple powrwrap@aol.com Digital Photography 29 01-01-2006 08:53 PM
Reproducing du/ls in Java Oreo Java 5 11-30-2004 02:35 AM
Size of digital images for reproducing in newspapers and magazines. Eric Clive Digital Photography 3 07-28-2004 04:01 PM
reproducing HttpContext behavior John ASP .Net 0 12-14-2003 04:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57