[twill] beautifulSoup via twill?
Titus Brown
titus at caltech.edu
Tue Jul 24 02:54:31 PDT 2007
On Mon, Jul 23, 2007 at 11:19:36PM -0700, Mike Gleeson wrote:
-> Mike Gleeson wrote:
-> > noob question - I'm not understanding how mechanize/beautifulSoup are
-> > utilized within Twill. I'm wanting to implement automated monitoring
-> > and parsing thereof and am unable to piece it together using python
-> > interactively. I'm trying to find a div via a css identifier and parse
-> > out the inner html. Should be straightforward but I don't see it.
-> >
-> > appreciate any help, thank you.
-> >
-> > - mike
-> >
-> >
-> here's how far I can get, I'm hoping there's a preferred way to utilize
-> mechanize and beautifulsoup:
->
-> from twill import *
-> from mechanize import _beautifulsoup
-> soup = _beautifulsoup.BeautifulSoup
-> b = get_browser()
-> b.go('http://somedomain.com')
-> x = soup(b.get_html())
-> y = x.fetch('div')
-> // and parse from there
->
-> comments, suggestions?
Hey Mike,
this is about what you have to do, yes. It seems like a good idea to
make a standardized API for it, though; do you have any thoughts on what
that should be?
Perhaps:
import twill
...
soup = twill.get_soup()
is simple enough?
--titus
More information about the twill
mailing list