6 points · by paraschopra · 17y ago · 4 comments
Anyhow here is what I am looking for: a (preferably open source) solution such as the one implemented in 'Select Content' step of http://www.dapper.net/dapp-factory.jsp
Dapper lets you select elements of a webpage inside the browser and do stuff with it. I was wondering how they do it and whether any of you have implemented similar functionality?
I've posted a Pastie of the Javascript code here: http://pastie.org/369649. It does use jQuery though. The w variable points to the window object of the external page that's loaded, so you can pass it around to other functions. Note that 'pageframe' is the ID of the iframe element.
As for the server side code, I used Django, with Python's urllib2 to load the page and BeautifulSoup to turn relative urls into absolute urls. If you end up using BeautifulSoup, note that even though it's supposed to handle invalid HTML, there are some pages that still won't work because Python's HTMLParser library isn't robust enough.
Basically from an opensource MIT project to do very close to what you're trying to do.
Alternately, you could contact YC startup http://www.awesomehighlighter.com/ for advice perhaps (which does EXACTLY what you're talking about).