mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 08:52:55 +01:00
add ability to download AO3 workskin if scaping styles is enabled
This commit is contained in:
parent
c50ffc40dc
commit
e5cc1cccf2
3 changed files with 25 additions and 3 deletions
|
|
@ -396,6 +396,18 @@ class ArchiveOfOurOwnOrgAdapter(BaseSiteAdapter):
|
|||
if i == 0:
|
||||
self.setSeries(series_name, series_index)
|
||||
self.story.setMetadata('seriesUrl',series_url)
|
||||
|
||||
|
||||
if 'style' in self.getConfigList('keep_html_attrs',[]):
|
||||
divmain = metasoup.find('div',{'id':'main'})
|
||||
if divmain:
|
||||
# we sort of assume ddmain exists because otherwise, there would be no fic
|
||||
workskin = divmain.style
|
||||
if workskin:
|
||||
workskin = str(workskin.contents[0]) # 'contents' returns a list with (here) a single element
|
||||
# some transformation to adjust which classes are affected
|
||||
workskin = workskin.replace('#workskin', '.userstuff')
|
||||
self.story.extra_css = "/*start of AO3 workskin*/\n" + workskin + "\n/* end of AO3 workskin*/\n"
|
||||
|
||||
def hookForUpdates(self,chaptercount):
|
||||
if self.newestChapterNum and self.oldchapters and len(self.oldchapters) > self.newestChapterNum:
|
||||
|
|
|
|||
|
|
@ -700,6 +700,7 @@ class Story(Requestable):
|
|||
self.chapter_text_replacements = []
|
||||
self.in_ex_cludes = {}
|
||||
self.chapters = [] # chapters will be dict containing(url,title,html,etc)
|
||||
self.extra_css = ""
|
||||
self.chapter_first = None
|
||||
self.chapter_last = None
|
||||
|
||||
|
|
|
|||
|
|
@ -172,10 +172,19 @@ class BaseStoryWriter(Requestable):
|
|||
|
||||
# minor cheat, tucking css into metadata.
|
||||
if self.getConfig("output_css"):
|
||||
self.story.setMetadata("output_css",
|
||||
self.getConfig("output_css"),
|
||||
condremoveentities=False)
|
||||
temp_css = self.getConfig("output_css")
|
||||
else:
|
||||
temp_css = ''
|
||||
if self.story.extra_css != '':
|
||||
if temp_css != '':
|
||||
temp_css += '\n'
|
||||
temp_css += self.story.extra_css
|
||||
|
||||
if temp_css:
|
||||
self.story.setMetadata("output_css",
|
||||
temp_css,
|
||||
condremoveentities=False)
|
||||
else:
|
||||
self.story.setMetadata("output_css",'')
|
||||
|
||||
if not outstream:
|
||||
|
|
|
|||
Loading…
Reference in a new issue