From 06920119db911928830664d8529b6e71c9496fa3 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 14 Aug 2011 19:42:37 -0500 Subject: [PATCH] Change hpcom to BeautifulSoup vs BeautifulStoneSoup to allow nested div tags. --- fanficdownloader/adapters/adapter_harrypotterfanfictioncom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fanficdownloader/adapters/adapter_harrypotterfanfictioncom.py b/fanficdownloader/adapters/adapter_harrypotterfanfictioncom.py index 126365b..155ebf7 100644 --- a/fanficdownloader/adapters/adapter_harrypotterfanfictioncom.py +++ b/fanficdownloader/adapters/adapter_harrypotterfanfictioncom.py @@ -178,7 +178,9 @@ class HarryPotterFanFictionComSiteAdapter(BaseSiteAdapter): logging.debug('Getting chapter text from: %s' % url) - soup = bs.BeautifulStoneSoup(self._fetchUrl(url), + ## most adapters use BeautifulStoneSoup here, but non-Stone + ## allows nested div tags. + soup = bs.BeautifulSoup(self._fetchUrl(url), selfClosingTags=('br','hr')) # otherwise soup eats the br/hr tags. div = soup.find('div', {'id' : 'fluidtext'})