Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47528

Re: Redirecting to a third party site with injected HTML

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Redirecting to a third party site with injected HTML
Date Mon, 10 Jun 2013 07:59:10 +0000 (UTC)
Organization A noiseless patient Spider
Lines 30
Message-ID <kp410e$5d9$1@dont-email.me> (permalink)
References <422dd712-2bc5-4c48-b6ca-62face5320c7@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Mon, 10 Jun 2013 07:59:10 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="66ffcfa4470a58bcddbdcd1913f98ab4"; logging-data="5545"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2NUC6AmEY3xZsSFJNzCDO3DfBsRUr75Q="
User-Agent Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2)
Cancel-Lock sha1:YffXSLTOOyY74ej9cK42QXfEmAU=
Xref csiph.com comp.lang.python:47528

Show key headers only | View raw


On Sun, 09 Jun 2013 10:09:17 -0700, guytamir1 wrote:

> i'm not really sure how to approach this problem..
> hints :)

Let me restate the problem for you:

You want to display a web page to a visitor that exists on a third party 
website, with some of your own html inserted into it.

Setting aside the multitude of ethical, moral, legal and copyright 
issues, the only technical solution I can see that doesn't involve 
hacking the third party website is to scrape the third party website 
using eg curl, modify the html using your scripting environment of choice 
(I'll assume python) either using some form of dom manipulation or string 
manipulation, and then server the modified page to the visitor.

so pycurl and pydom might be good places to start.

Don't forget that you may need to rewrite urls in the scraped document 
for things such as anchors, images, css, javascript etc to point them 
back at the host server, or some script on your server that can obtain 
and serve the appropriate resources.

Alternatively, how about displaying the third party website in an iframe 
within your own document? Although that's not really pythonic, just 
htmlic.

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Redirecting to a third party site with injected HTML guytamir1@gmail.com - 2013-06-09 10:09 -0700
  Re: Redirecting to a third party site with injected HTML Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-09 13:14 -0400
  Re: Redirecting to a third party site with injected HTML Fábio Santos <fabiosantosart@gmail.com> - 2013-06-09 18:22 +0100
    Re: Redirecting to a third party site with injected HTML guytamir1@gmail.com - 2013-06-09 10:52 -0700
      Re: Redirecting to a third party site with injected HTML Joel Goldstick <joel.goldstick@gmail.com> - 2013-06-09 14:03 -0400
      Re: Redirecting to a third party site with injected HTML Roy Smith <roy@panix.com> - 2013-06-09 14:53 -0400
  Re: Redirecting to a third party site with injected HTML Ian <hobson42@gmail.com> - 2013-06-09 19:24 +0100
    Re: Redirecting to a third party site with injected HTML Guy Tamir <guytamir1@gmail.com> - 2013-06-09 23:50 -0700
      Re: Redirecting to a third party site with injected HTML Fábio Santos <fabiosantosart@gmail.com> - 2013-06-10 08:51 +0100
  Re: Redirecting to a third party site with injected HTML Tim Chase <python.list@tim.thechases.com> - 2013-06-09 13:31 -0500
  Re: Redirecting to a third party site with injected HTML Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-10 07:59 +0000

csiph-web