Workaround for adapter_hentaifoundrycom bad dateUpdated value.

This commit is contained in:
Jim Miller 2018-12-10 11:33:11 -06:00
parent 2ac2f8a1eb
commit ded6f59c79
3 changed files with 21 additions and 2 deletions

View file

@ -2462,7 +2462,7 @@ add_to_titlepage_entries:,growth, shrink, sizeroles
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
extra_valid_entries:comments,views,size,favs,vote_rating
extra_titlepage_entries:comments,views,size,favs,vote_rating
add_to_titlepage_entries:comments,views,size,favs,vote_rating
comments_label:Comments
views_label:Views
@ -2488,6 +2488,12 @@ vote_rating_label:Votes(Rating)
## datePublished_format
#datechapter_format:%%Y-%%m-%%d
## Sometimes (perhaps often?) HF stories word counts and size are
## incorrect. You can exclude them from being used like so:
#add_to_exclude_metadata_pre:
# numWords=~.*
# size=~.*
[www.hpfanficarchive.com]
## Site dedicated to these categories/characters/ships
extracategories:Harry Potter

View file

@ -147,6 +147,7 @@ class HentaiFoundryComSiteAdapter(BaseSiteAdapter):
'Comments:':'comments',
'views:':'views',
}
updateDate = self.story.getMetadataRaw('dateUpdated')
boxbody = h1.find_next('div',class_='boxbody')
for a in boxbody.find_all('a'):
# <small>
@ -165,9 +166,15 @@ class HentaiFoundryComSiteAdapter(BaseSiteAdapter):
val = label.next_sibling.replace('','').strip() # remove bullets.
if l.endswith('date'):
d = makeDate(val,self.dateformat)
if d > updateDate:
updateDate = d
val = d.strftime(self.getConfig("datechapter_format",self.getConfig("datePublished_format","%Y-%m-%d")))
chap_meta[l] = val
self.add_chapter(stripHTML(a),'https://'+self.host+a['href'],chap_meta)
## site can screw up updated date, take from newest chapter date if greater.
if updateDate != self.story.getMetadataRaw('dateUpdated'):
self.story.setMetadata('dateUpdated',updateDate)
def getChapterText(self, url):

View file

@ -2490,7 +2490,7 @@ add_to_titlepage_entries:,growth, shrink, sizeroles
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
extra_valid_entries:comments,views,size,favs,vote_rating
extra_titlepage_entries:comments,views,size,favs,vote_rating
add_to_titlepage_entries:comments,views,size,favs,vote_rating
comments_label:Comments
views_label:Views
@ -2516,6 +2516,12 @@ vote_rating_label:Votes(Rating)
## datePublished_format
#datechapter_format:%%Y-%%m-%%d
## Sometimes (perhaps often?) HF stories word counts and size are
## incorrect. You can exclude them from being used like so:
#add_to_exclude_metadata_pre:
# numWords=~.*
# size=~.*
[www.hpfanficarchive.com]
## Site dedicated to these categories/characters/ships
extracategories:Harry Potter