mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-15 21:32:28 +01:00
More log clean up, better handling of bad URL in ficwad, missing story in ffnet.
This commit is contained in:
parent
1426626d0a
commit
7420d27652
8 changed files with 15 additions and 9 deletions
|
|
@ -141,7 +141,9 @@ class FanfictionSiteAdapter:
|
|||
return self.storyName
|
||||
|
||||
def getStoryDescription(self):
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
## with out stripping \n's, appengine treats additional lines from this debug
|
||||
## output as error messages.
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
return self.storyDescription
|
||||
|
||||
def getStoryCreated(self):
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ class FFNet(FanfictionSiteAdapter):
|
|||
self.storyDescription = self.storyDescription + '&' + ss
|
||||
else:
|
||||
self.storyDescription = ss
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace('\n',' ').replace('\r',''))
|
||||
elif l.find("var datep") != -1:
|
||||
dateps = self._getVarValue (l)
|
||||
self.storyPublished = datetime.datetime(*time.strptime ( dateps, "'%m-%d-%y'" )[0:5])
|
||||
|
|
@ -314,6 +314,9 @@ class FFNet(FanfictionSiteAdapter):
|
|||
|
||||
div = soup.find('div', {'id' : 'storytext'})
|
||||
if None == div:
|
||||
if "Story Not Found" in data:
|
||||
logging.info("Story not Found at %s" % url)
|
||||
raise FailedToDownload("Story not Found at %s" % url)
|
||||
logging.debug(data)
|
||||
raise FailedToDownload("Error downloading Chapter: %s! Missing required element!" % url)
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class FictionAlley(FanfictionSiteAdapter):
|
|||
logging.debug('self.storyCharacters=%s' % self.storyCharacters)
|
||||
elif keystr == 'Summary:':
|
||||
self.storyDescription = valstr
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
|
||||
|
||||
def extractIndividualUrls(self):
|
||||
|
|
@ -208,7 +208,7 @@ class FictionAlley(FanfictionSiteAdapter):
|
|||
self.storyRating = ss1[1]
|
||||
logging.debug('self.storyRating=%s' % self.storyRating)
|
||||
self.storyDescription = unicode(ss[1]).replace("<br>","").replace("</br>","").replace('\n','')
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
|
||||
for li in links:
|
||||
a = li.find('a', {'class' : 'chapterlink'})
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class FicWad(FanfictionSiteAdapter):
|
|||
description = soup.find('blockquote', {'class' : 'summary'})
|
||||
if description is not None:
|
||||
self.storyDescription = unicode(description.p.string)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace('\n',' ').replace('\r',''))
|
||||
|
||||
meta = soup.find('p', {'class' : 'meta'})
|
||||
if meta is not None:
|
||||
|
|
@ -175,6 +175,7 @@ class FicWad(FanfictionSiteAdapter):
|
|||
allBlocked = storylist.findAll('li', {'class' : 'blocked'})
|
||||
if allBlocked is not None:
|
||||
#logging.debug('allBlocked=%s' % allBlocked)
|
||||
raise FailedToDownload("Are you sure %s is a chapter URL(not the chapter list)?"%cururl)
|
||||
raise LoginRequiredException(cururl)
|
||||
|
||||
allH4s = storylist.findAll('h4')
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class FPCom(FanfictionSiteAdapter):
|
|||
for meta in metas:
|
||||
if 'content' in meta._getAttrMap():
|
||||
self.storyDescription = unicode(meta['content'])
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
|
||||
title=meta.find('title')
|
||||
logging.debug('title=%s' % title.string)
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ class HPFiction(FanfictionSiteAdapter):
|
|||
else:
|
||||
ii = ii + 1
|
||||
self.storyDescription = sss
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
|
||||
urls = []
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class MediaMiner(FanfictionSiteAdapter):
|
|||
pass
|
||||
elif ssbt == 'Summary:':
|
||||
self.storyDescription = sst.strip()
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription)
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
elif ssbt == 'Latest Revision:' or ssbt == 'Uploaded On:':
|
||||
#logging.debug('sst=%s' % sst)
|
||||
ssts = sst.split(' ')
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class Twilighted(FanfictionSiteAdapter):
|
|||
ps = s1.findAll('p')
|
||||
if len(ps) > 0:
|
||||
self.storyDescription = ps[0]
|
||||
logging.debug('self.storyDescription=%s' % (self.storyDescription))
|
||||
logging.debug('self.storyDescription=%s' % self.storyDescription.replace("\n"," ").replace('\r',''))
|
||||
else:
|
||||
divs = meta.findAll('div')
|
||||
#logging.debug('Divs: %s' % divs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue