From efeac1885cd0211754b34e173a5efb74b6cbedb2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 1 Sep 2009 15:39:54 +0100 Subject: [PATCH] Do entity conversion ourselves; lenny's BS won't for some reason --- yarrg/yppedia-ocean-scraper | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/yarrg/yppedia-ocean-scraper b/yarrg/yppedia-ocean-scraper index 5f9c5f0..30d0c4a 100755 --- 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) - soup = BeautifulSoup(dataf, - convertEntities=BeautifulSoup.HTML_ENTITIES) + soup = BeautifulSoup(dataf) title_arch_re = regexp.compile('(\\S.*\\S) Archipelago \\((\\S+)\\)$') @@ -86,9 +85,13 @@ def title_arch_ok(t): 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) + debug('s',s) + return s def parse_ocean(): firstarch = soup.find('a', attrs = {'title': title_arch_ok}) -- 2.30.2