adapter_literotica: Add chapter descriptions to summary

This commit is contained in:
dbhmw 2025-12-07 22:01:22 +00:00
parent edaa03ef42
commit 1e90c14306
4 changed files with 15 additions and 7 deletions

View file

@ -2331,6 +2331,8 @@ description_in_chapter: false
## This option will attemph to fetch the stories.
fetch_stories_from_api: true
include_chapter_descriptions_in_summary: false
## Clear FanFiction from defaults, site is original fiction.
extratags:Erotica

View file

@ -235,19 +235,19 @@ class LiteroticaSiteAdapter(BaseSiteAdapter):
## look first for 'Series Introduction', then Info panel short desc
## series can have either, so put in common code.
desc = []
introtag = soup.select_one('div.bp_rh')
descdiv = soup.select_one('div#tabpanel-info div.bn_B')
if not descdiv:
descdiv = soup.select_one('div[class^="_tab__pane_"] div[class^="_widget__info_"]')
descdiv = soup.select_one('div#tabpanel-info div.bn_B') or \
soup.select_one('div[class^="_tab__pane_"] div[class^="_widget__info_"]')
if introtag and stripHTML(introtag):
# make sure there's something in the tag.
# logger.debug("intro %s"%introtag)
self.setDescription(self.url,introtag)
desc.append(unicode(introtag))
elif descdiv and stripHTML(descdiv):
# make sure there's something in the tag.
# logger.debug("desc %s"%descdiv)
self.setDescription(self.url,descdiv)
else:
desc.append(unicode(descdiv))
if not desc or self.getConfig("include_chapter_descriptions_in_summary"):
## Only for backward compatibility with 'stories' that
## don't have an intro or short desc.
descriptions = []
@ -257,7 +257,9 @@ class LiteroticaSiteAdapter(BaseSiteAdapter):
descriptions.append("%d. %s" % (i + 1, stripHTML(chapterdesctag)))
# now put it back--it's used below
chapterdesctag.append(a)
self.setDescription(authorurl,"<p>"+"</p>\n<p>".join(descriptions)+"</p>")
desc.append(unicode("<p>"+"</p>\n<p>".join(descriptions)+"</p>"))
self.setDescription(self.url,u''.join(desc))
if isSingleStory:
## one-shots don't *display* date info, but they have it

View file

@ -271,6 +271,7 @@ def get_valid_set_options():
'order_chapters_by_date':(['literotica.com'],None,boollist),
'tags_from_chapters':(['literotica.com'],None,boollist),
'dates_from_chapters':(['literotica.com'],None,boollist),
'include_chapter_descriptions_in_summary':(['literotica.com'],None,boollist),
'inject_chapter_title':(['asianfanfics.com']+wpc_list,None,boollist),
'inject_chapter_image':(['asianfanfics.com'],None,boollist),
@ -528,6 +529,7 @@ def get_valid_keywords():
'fetch_stories_from_api',
'tags_from_chapters',
'dates_from_chapters',
'include_chapter_descriptions_in_summary',
'inject_chapter_title',
'inject_chapter_image',
'append_datepublished_to_storyurl',

View file

@ -2324,6 +2324,8 @@ description_in_chapter: false
## This option will attemph to fetch the stories.
fetch_stories_from_api: true
include_chapter_descriptions_in_summary: false
## Clear FanFiction from defaults, site is original fiction.
extratags:Erotica