From e64331553256fa66716315d403cc93497b7b6dff Mon Sep 17 00:00:00 2001 From: Chris Braun Date: Wed, 20 Sep 2017 20:15:29 +0200 Subject: [PATCH] Fix parsing of author name for webnovel.com (hopefully) (#232) --- fanficfare/adapters/adapter_webnovelcom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fanficfare/adapters/adapter_webnovelcom.py b/fanficfare/adapters/adapter_webnovelcom.py index 85a12204..b6f95a2e 100644 --- a/fanficfare/adapters/adapter_webnovelcom.py +++ b/fanficfare/adapters/adapter_webnovelcom.py @@ -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)