Merge pull request #975 from Gluejar/maintenance2021

harvest nomos, euna
pull/94/head
Eric Hellman 2021-11-02 19:31:05 -04:00 committed by GitHub
commit eb5393ad57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -122,6 +122,7 @@ STOREPROVIDERS = [
"karolinum.cz",
"librumstore.com",
"logos-verlag.de",
"nomos-shop.de",
"palgrave.com",
"play.google.com",
"press.umich.edu",
@ -201,6 +202,7 @@ def harvesters(ebook):
yield ebook.provider == 'fulcrum.org', harvest_fulcrum
yield ebook.provider in ('epress.lib.uts.edu.au', 'utsepress.lib.uts.edu.au'), harvest_ubiquity
yield ebook.provider == 'orkana.no', harvest_orkana
yield ebook.provider == 'euna.una.ac.cr', harvest_euna
def ebf_if_harvested(url):
onlines = models.EbookFile.objects.filter(source=url)
@ -544,10 +546,15 @@ def harvest_digitalis(ebook):
NOMOSPDF = re.compile('download_full_pdf')
def harvest_nomos(ebook):
doc = get_soup(ebook.url, follow_redirects=True)
try:
base = doc.find('base')['href']
except:
base = ebook.url
if doc:
obj = doc.find('a', href=NOMOSPDF)
if obj:
dl_url = urljoin(ebook.url, obj['href'])
dl_url = urljoin(base, obj['href'])
return make_dl_ebook(dl_url, ebook)
else:
logger.warning('will try stapling a book for %s', ebook.url)
@ -997,4 +1004,11 @@ def harvest_orkana(ebook):
yield div.find_next_sibling('div').find('a')
return harvest_multiple_generic(ebook, selector)
def harvest_euna(ebook):
if '/view/' in ebook.url:
return make_dl_ebook(ebook.url.replace('view', 'download'), ebook)
set_bookshop(ebook)
return None, 0