Mercurial > ~darius > hgwebdir.cgi > scrape-gm
comparison scrape-gm.py @ 10:0e18c714b69d
Update for new page layout.
Luckily no substative changes! :)
author | darius@inchoate.localdomain |
---|---|
date | Fri, 29 Feb 2008 19:19:14 +1030 |
parents | fbaf34d7bab7 |
children | 22a51e8c0a69 |
comparison
equal
deleted
inserted
replaced
9:3ef64337d86b | 10:0e18c714b69d |
---|---|
97 FixTags = staticmethod(FixTags) | 97 FixTags = staticmethod(FixTags) |
98 | 98 |
99 def Scrape(handle): | 99 def Scrape(handle): |
100 s = BeautifulSoup.BeautifulSoup(handle) | 100 s = BeautifulSoup.BeautifulSoup(handle) |
101 | 101 |
102 playertbl = s.find("table", "search_table") | 102 playertbl = s.find("table", "results") |
103 if (playertbl == None): | 103 if (playertbl == None): |
104 #print "Unable to find results" | 104 #print "Unable to find results" |
105 return None | 105 return None |
106 | 106 |
107 servertbl = playertbl.findNext("table", "search_table") | 107 servertbl = playertbl.findNext("table", "results") |
108 | 108 |
109 playerrows = playertbl.findAll("tr") | 109 playerrows = playertbl.findAll("tr") |
110 serverrows = servertbl.findAll("tr") | 110 serverrows = servertbl.findAll("tr") |
111 | 111 |
112 if (len(playerrows) != len(serverrows)): | 112 if (len(playerrows) != len(serverrows)): |