Fix parsing of author name for webnovel.com (hopefully) (#232)

This commit is contained in:
Chris Braun 2017-09-20 20:15:29 +02:00 committed by Jim Miller
parent 20e96aa056
commit e643315532

View file

@ -137,13 +137,15 @@ class WWWWebNovelComAdapter(BaseSiteAdapter):
tag.extract()
self.story.setMetadata('title', stripHTML(title))
# TODO: This should be more robust...
# Find authorid and URL from... author url.
paras = bookdetails.find_all('p')
for para in paras:
parat = stripHTML(para)
if parat[:7] == 'Author:':
self.story.setMetadata('author', parat.replace('Author:', '').strip())
self.story.setMetadata('authorId', parat.replace('Author:', '').strip())
author = parat.split('Author:', 1)[1].split(u'\xb7', 1)[0].strip()
self.story.setMetadata('author', author)
self.story.setMetadata('authorId', author)
# There is no authorUrl for this site, so I'm setting it to the story url
# otherwise it defaults to the file location
self.story.setMetadata('authorUrl', url)