Improve ffnet error checking.

This commit is contained in:
Jim Miller 2011-06-20 14:24:21 -05:00
parent 5afd7b8c06
commit 9863616eae

View file

@ -205,15 +205,20 @@ class FanFictionNetSiteAdapter(BaseSiteAdapter):
## more if hit too fast. This is in
## additional to what ever the
## slow_down_sleep_time setting is.
soup = bs.BeautifulSoup(self._fetchUrl(url))
data = self._fetchUrl(url)
soup = bs.BeautifulSoup(data)
## Remove the 'share' button.
sharediv = soup.find('div', {'class' : 'a2a_kit a2a_default_style'})
sharediv.extract()
if sharediv:
sharediv.extract()
else:
logging.debug('share button div not found')
div = soup.find('div', {'id' : 'storytext'})
if None == div:
logging.debug('div id=storytext not found. data:%s'%data)
raise exceptions.FailedToDownload("Error downloading Chapter: %s! Missing required element!" % url)
return utf8FromSoup(div)