mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 08:52:55 +01:00
Merge pull request #689 from AlexRiina/adapter-novelfull-2
add more story meta-data and fix more extra chapter headings
This commit is contained in:
commit
ef7ba42f9a
1 changed files with 12 additions and 2 deletions
|
|
@ -21,7 +21,17 @@ class NovelFullSiteAdapter(BaseSiteAdapter):
|
||||||
return "novelfull.com"
|
return "novelfull.com"
|
||||||
|
|
||||||
def getSiteURLPattern(self):
|
def getSiteURLPattern(self):
|
||||||
return r"https?://%s/(?P<name>.+).html?" % re.escape(self.getSiteDomain())
|
return r"https?://%s/(index\.php/)?(?P<story_id>.+?)(/.*)?\.html?" % re.escape(self.getSiteDomain())
|
||||||
|
|
||||||
|
def __init__(self, configuration, url):
|
||||||
|
super(NovelFullSiteAdapter, self).__init__(configuration, url)
|
||||||
|
|
||||||
|
story_id = re.match(self.getSiteURLPattern(), url).group('story_id')
|
||||||
|
self.story.setMetadata('storyId', story_id)
|
||||||
|
|
||||||
|
self._setURL("https://%s/%s.html" % (self.getSiteDomain(), story_id))
|
||||||
|
|
||||||
|
self.story.setMetadata('siteabbrev', 'nvlfl')
|
||||||
|
|
||||||
def extractChapterUrlsAndMetadata(self):
|
def extractChapterUrlsAndMetadata(self):
|
||||||
data = self.get_request(self.url)
|
data = self.get_request(self.url)
|
||||||
|
|
@ -75,7 +85,7 @@ class NovelFullSiteAdapter(BaseSiteAdapter):
|
||||||
content = soup.find(id="chapter-content")
|
content = soup.find(id="chapter-content")
|
||||||
|
|
||||||
# Remove chapter header if present
|
# Remove chapter header if present
|
||||||
chapter_header = content.find("p", text=re.compile(r"Chapter \d+:"))
|
chapter_header = content.find(["p", "h3"], text=re.compile(r"Chapter \d+:"))
|
||||||
|
|
||||||
if chapter_header:
|
if chapter_header:
|
||||||
chapter_header.decompose()
|
chapter_header.decompose()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue