fix bookloader when a bookdata is empty
parent
37a5486abe
commit
7bd6fba096
|
@ -1113,6 +1113,7 @@ def add_from_bookdatas(bookdatas):
|
|||
editions = []
|
||||
for bookdata in bookdatas:
|
||||
edition = work = None
|
||||
if bookdata and bookdata.metadata:
|
||||
loader = BasePandataLoader(bookdata.base)
|
||||
pandata = Pandata()
|
||||
pandata.metadata = bookdata.metadata
|
||||
|
|
|
@ -69,9 +69,12 @@ class BaseScraper(object):
|
|||
self.set('title', '!!! missing title !!!')
|
||||
if not self.metadata.get('language', None):
|
||||
self.set('language', 'en')
|
||||
else:
|
||||
self.metadata = {}
|
||||
self.metadata['identifiers'] = self.identifiers
|
||||
else:
|
||||
self.metadata = None
|
||||
else:
|
||||
self.metadata = None
|
||||
|
||||
|
||||
#
|
||||
# utilities
|
||||
|
|
|
@ -146,9 +146,9 @@ class SpringerScraper(BaseScraper):
|
|||
self.set('rights_url', lic_url)
|
||||
|
||||
def get_pubdate(self):
|
||||
pubinfo = self.doc.select_one('#copyright-info')
|
||||
pubinfo = self.doc.find(attrs={"data-test": "electronic_isbn_publication_date"})
|
||||
if not pubinfo:
|
||||
pubinfo = self.doc.select_one('header .c-article-identifiers')
|
||||
pubinfo = self.doc.find(attrs={"data-test": "softcover_isbn_publication_date"})
|
||||
if pubinfo:
|
||||
for yearstring in pubinfo.stripped_strings:
|
||||
yearmatch = HAS_YEAR.search(yearstring)
|
||||
|
|
Loading…
Reference in New Issue