Add rating and sitetags to adapter_webnovelcom.

This commit is contained in:
Jim Miller 2018-05-03 12:02:19 -05:00
parent 04eaab1acf
commit 157b0555e4
3 changed files with 16 additions and 5 deletions

View file

@ -2987,10 +2987,11 @@ website_encodings:Windows-1252,utf8
[www.webnovel.com]
## Extra metadata that this adapter knows about. See [archiveofourown.org]
## for examples of how to use them.
extra_valid_entries:translator, editor
extra_valid_entries:translator, editor, sitetags
translator_label: Translator
editor_label: Editor
extra_titlepage_entries: translator, editor
sitetags_label:Site Tags
extra_titlepage_entries: translator, editor, sitetags
## webnovel.com is, as a whole, utf-8. There are even utf-8 encoded
## Chinese characters in the HTML *comments*. However, I've seen at

View file

@ -148,6 +148,11 @@ class WWWWebNovelComAdapter(BaseSiteAdapter):
cats = bookdetails.find_all('a',href=re.compile(r'/category/list'))
self.story.extendList('category',[cat.string for cat in cats])
poptags = soup.find('p',{'class':'pop-tags'})
if poptags:
sitetags = poptags.find_all('a',href=re.compile(r'/tag/list'))
self.story.extendList('sitetags',[sitetag.string for sitetag in sitetags])
## get _csrfToken cookie for chapter list fetch
for cookie in self.get_configuration().get_cookiejar():
if cookie.name == '_csrfToken':
@ -179,8 +184,12 @@ class WWWWebNovelComAdapter(BaseSiteAdapter):
cover_url = 'https:' + cover_meta['src']
self.setCoverImage(url, cover_url)
synopsis = soup.find('div', {'class': 'det-abt'}).find('p')
detabt = soup.find('div', {'class': 'det-abt'})
synopsis = detabt.find('p')
self.setDescription(url, synopsis)
rating = detabt.find('span',{'class': 'vam'})
if rating:
self.story.setMetadata('rating',rating.string)
last_updated_string = jsondata['data']['bookInfo']['newChapterTime']
last_updated = parse_relative_date_string(last_updated_string)

View file

@ -3015,10 +3015,11 @@ website_encodings:Windows-1252,utf8
[www.webnovel.com]
## Extra metadata that this adapter knows about. See [archiveofourown.org]
## for examples of how to use them.
extra_valid_entries:translator, editor
extra_valid_entries:translator, editor, sitetags
translator_label: Translator
editor_label: Editor
extra_titlepage_entries: translator, editor
sitetags_label:Site Tags
extra_titlepage_entries: translator, editor, sitetags
## webnovel.com is, as a whole, utf-8. There are even utf-8 encoded
## Chinese characters in the HTML *comments*. However, I've seen at