Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55808 > unrolled thread
| Started by | Tracubik <affdfsdfdsfsd@b.com> |
|---|---|
| First post | 2011-02-01 21:20 +0000 |
| Last post | 2011-02-01 22:27 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
how to get and search a html file from a website Tracubik <affdfsdfdsfsd@b.com> - 2011-02-01 21:20 +0000
Re: how to get and search a html file from a website Corey Richardson <kb1pkl@aim.com> - 2011-02-01 16:33 -0500
Re: how to get and search a html file from a website Paul Anton Letnes <paul.anton.letnes@gmail.com> - 2011-02-01 22:27 +0100
| From | Tracubik <affdfsdfdsfsd@b.com> |
|---|---|
| Date | 2011-02-01 21:20 +0000 |
| Subject | how to get and search a html file from a website |
| Message-ID | <4d48791d$0$1342$4fafbaef@reader2.news.tin.it> |
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?
thanks
Medeo
[toc] | [next] | [standalone]
| From | Corey Richardson <kb1pkl@aim.com> |
|---|---|
| Date | 2011-02-01 16:33 -0500 |
| Message-ID | <mailman.1557.1296596312.6505.python-list@python.org> |
| In reply to | #55808 |
On 02/01/2011 04:20 PM, Tracubik 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?
>
> thanks
> Medeo
urllib2
http://docs.python.org/howto/urllib2.html
If you need fancy-shmancy parsing, look into:
http://docs.python.org/library/htmlparser.html
Or you can treat the returned site as a string and just search for that
sentence.
[toc] | [prev] | [next] | [standalone]
| From | Paul Anton Letnes <paul.anton.letnes@gmail.com> |
|---|---|
| Date | 2011-02-01 22:27 +0100 |
| Message-ID | <ii9trs$3su$1@news.eternal-september.org> |
| In reply to | #55808 |
Den 01.02.11 22.20, skrev Tracubik:
> 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?
>
> thanks
> Medeo
Of course there is a pythonic way :-)
>>> import urllib
>>> urllib.urlretrieve('http://docs.python.org/tutorial/index.html',
'tut.html')
Good luck,
Paul.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web