how to get and search a html file from a website

James Mills prologic at shortcircuit.net.au
Tue Feb 1 16:37:08 EST 2011


On Wed, Feb 2, 2011 at 7:20 AM, Tracubik <affdfsdfdsfsd at b.com> wrote:
> Hi all!
> i'm writing a notification program and i'm quite new to python.
> The program have to check every 5 minutes a particular website and alert
> me when a particular sentence ("user online") is in the html.
> i've thinked to use a text browser (lynx) to retrieve the html and parse
> the output in python as a normal text file.
> Do you have any better idea?

Assuming the website in question does not provide
any useful APIs (sad), then a better approach is to
use the urllib library in conjunction with lxml to
parse the html in a sensible way (instead of just
doing: if "foo" in s)

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"



More information about the Python-list mailing list