whoficcom only - viewstory.php url can appear descs, look for reviews.php.

This commit is contained in:
Jim Miller 2011-10-31 11:08:25 -05:00
parent 141ed90d74
commit a3402170ad
2 changed files with 7 additions and 5 deletions

View file

@ -112,11 +112,13 @@ class WhoficComSiteAdapter(BaseSiteAdapter):
logging.debug("Author URL: "+self.story.getMetadata('authorUrl')) logging.debug("Author URL: "+self.story.getMetadata('authorUrl'))
soup = bs.BeautifulStoneSoup(self._fetchUrl(self.story.getMetadata('authorUrl')), soup = bs.BeautifulStoneSoup(self._fetchUrl(self.story.getMetadata('authorUrl')),
selfClosingTags=('br')) # normalize <br> tags to <br /> selfClosingTags=('br')) # normalize <br> tags to <br />
# find this story in the list, parse it's metadata based on # find this story in the list, parse it's metadata based on
# lots of assumptions about the html, since there's little # lots of assumptions about the html, since there's little
# tagging. # tagging.
a = soup.find('a', href=re.compile(r'viewstory.php\?sid='+self.story.getMetadata('storyId'))) # Found a story once that had the story URL in the desc for a
# series on the same author's page. Now using the reviews
# link instead to find the appropriate metadata.
a = soup.find('a', href=re.compile(r'reviews.php\?sid='+self.story.getMetadata('storyId')))
metadata = a.findParent('td') metadata = a.findParent('td')
metadatachunks = utf8FromSoup(metadata).split('<br />') metadatachunks = utf8FromSoup(metadata).split('<br />')
# process metadata for this story. # process metadata for this story.
@ -156,7 +158,6 @@ class WhoficComSiteAdapter(BaseSiteAdapter):
for g in genre.split(r', '): for g in genre.split(r', '):
self.story.addToList('genre',g) self.story.addToList('genre',g)
# the next line is stuff with ' - ' separators *and* names--with tags. # the next line is stuff with ' - ' separators *and* names--with tags.
moremeta = metadatachunks[5] moremeta = metadatachunks[5]
moremeta = re.sub(r'<[^>]+>','',moremeta) # strip tags. moremeta = re.sub(r'<[^>]+>','',moremeta) # strip tags.

View file

@ -53,18 +53,19 @@
<p>Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites <p>Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites
much easier. </p> much easier. </p>
</div> </div>
<!-- put announcements here, h3 is a good title size. --> <!-- put announcements here, h3 is a good title size.
<p> <p>
<b>New Site:</b> Now supporting fimfiction.net. Many <b>New Site:</b> Now supporting fimfiction.net. Many
thanks to our latest developer, althaine, for this new thanks to our latest developer, althaine, for this new
adapter. adapter.
</p> </p>
-->
<p> <p>
If you have any problems with this application, please If you have any problems with this application, please
report them in report them in
the <a href="http://groups.google.com/group/fanfic-downloader">Fanfiction the <a href="http://groups.google.com/group/fanfic-downloader">Fanfiction
Downloader Google Group</a>. The Downloader Google Group</a>. The
<a href="http://4-0-5.fanfictionloader.appspot.com">Previous <a href="http://4-0-6.fanfictionloader.appspot.com">Previous
Version</a> is also available for you to use if necessary. Version</a> is also available for you to use if necessary.
</p> </p>
<div id='error'> <div id='error'>