Extracting specific data from the website

7 views
Skip to first unread message

aung myat

unread,
Feb 4, 2012, 12:34:32 AM2/4/12
to beautifulsoup
Hello

I am totally new to python and beautiful soup. I would like to develop
a script.

The followings are my requirements:

1) I want to extract a number from the webpage and constantly monitor
the number change.
2) Once there is a change in number, the script should compare with
the number extracted earlier.
3) If new number is greater, the script should trigger to do some
tasks. (i.e something like API for interface with another script).

Please see below HTML to understand more.

</font></b>
</td>
</tr>

<tr>
<td />
<td />
<td><font color=#FF0000> <b>SPK QC<b>
<td>
<b>
<font color=#FF0000>
420265

I have to search for the text "SPK QC" and extract 420265 and store in
the variable.
I would like to know how should I modify the python code below.

import u3
import time
import urllib2


def Write_LJ():
d = u3.U3()
FI04_STATE_REGISTER = 6004
while True:
time.sleep(2)
d.writeRegister(FI04_STATE_REGISTER, 1)
print " Output 4 is 0 "
time.sleep(2)
d.writeRegister(FI04_STATE_REGISTER, 0)
print " Output 4 is 1 "

def Get_CL():
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen("http://col-
seaferret.colo.seagate.com/PushFITSScripts.php").read())
print soup.prettify()


def main():
Get_CL()
Write_LJ()

main()

Anybody has any idea please help. Thank you very much in advance.
Reply all
Reply to author
Forward
0 new messages