chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More oceans
[ypp-sc-tools.db-live.git]
/
yarrg
/
yppedia-ocean-scraper
diff --git
a/yarrg/yppedia-ocean-scraper
b/yarrg/yppedia-ocean-scraper
index 5f9c5f007b46fda4265ccc7492dc2b3d58e079f0..a85403504aae52764a1a6d96f7202f6444c005ed 100755
(executable)
--- a/
yarrg/yppedia-ocean-scraper
+++ b/
yarrg/yppedia-ocean-scraper
@@
-62,8
+62,7
@@
def fetch():
debug('fetching',url)
dataf = urllib2.urlopen(url)
debug('fetched',dataf)
debug('fetching',url)
dataf = urllib2.urlopen(url)
debug('fetched',dataf)
- soup = BeautifulSoup(dataf,
- convertEntities=BeautifulSoup.HTML_ENTITIES)
+ soup = BeautifulSoup(dataf)
title_arch_re = regexp.compile('(\\S.*\\S) Archipelago \\((\\S+)\\)$')
title_arch_re = regexp.compile('(\\S.*\\S) Archipelago \\((\\S+)\\)$')
@@
-86,13
+85,17
@@
def title_arch_ok(t):
def parse_chart():
ta = soup.find('textarea')
debug('ta',ta)
def parse_chart():
ta = soup.find('textarea')
debug('ta',ta)
- rc = ta.renderContents()
- debug('rc',rc)
- return rc
+ s = ta.string
+ debug('s',s)
+ s = regexp.sub(r'\<\;', '<', s)
+ s = regexp.sub(r'\>\;', '>', s)
+ s = regexp.sub(r'\"\;', '"', s)
+ s = regexp.sub(r'\&\;', '&', s)
+ debug('s',s)
+ return s
def parse_ocean():
def parse_ocean():
- firstarch = soup.find('a', attrs = {'title': title_arch_ok})
- debug('fa',firstarch)
+ content = soup.find('div', attrs = {'id': 'content'})
def findall_title_arch_ok(t):
return t.findAll('a', attrs = {'title': title_arch_ok})
def findall_title_arch_ok(t):
return t.findAll('a', attrs = {'title': title_arch_ok})
@@
-101,7
+104,7
@@
def parse_ocean():
if u.name != 'table': return False
return len(findall_title_arch_ok(u)) > 1
if u.name != 'table': return False
return len(findall_title_arch_ok(u)) > 1
- archestable =
firstarch.findParent
('table', attrs={'border':'1'})
+ archestable =
content.findChild
('table', attrs={'border':'1'})
debug('at',archestable)
archsoups = []
debug('at',archestable)
archsoups = []