mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 21:43:51 +02:00
Amazon metadata plugin: Fix metadata for adult books not being downloaded because google does not cache those pages.
This commit is contained in:
parent
449191df19
commit
6eb67b9b80
1 changed files with 7 additions and 3 deletions
|
|
@ -839,7 +839,7 @@ def parse_language(self, pd):
|
|||
class Amazon(Source):
|
||||
|
||||
name = 'Amazon.com'
|
||||
version = (1, 2, 1)
|
||||
version = (1, 2, 2)
|
||||
minimum_calibre_version = (2, 82, 0)
|
||||
description = _('Downloads metadata and covers from Amazon')
|
||||
|
||||
|
|
@ -1264,7 +1264,7 @@ def search_amazon(self, br, testing, log, abort, title, authors, identifiers, ti
|
|||
return matches, query, domain, None
|
||||
# }}}
|
||||
|
||||
def search_search_engine(self, br, testing, log, abort, title, authors, identifiers, timeout): # {{{
|
||||
def search_search_engine(self, br, testing, log, abort, title, authors, identifiers, timeout, override_server=None): # {{{
|
||||
from calibre.ebooks.metadata.sources.update import search_engines_module
|
||||
terms, domain = self.create_query(log, title=title, authors=authors,
|
||||
identifiers=identifiers, for_amazon=False)
|
||||
|
|
@ -1272,7 +1272,7 @@ def search_search_engine(self, br, testing, log, abort, title, authors, identifi
|
|||
domain)[len('https://'):].partition('/')[0]
|
||||
matches = []
|
||||
se = search_engines_module()
|
||||
server = self.server
|
||||
server = override_server or self.server
|
||||
if server in ('bing',):
|
||||
urlproc, sfunc = se.bing_url_processor, se.bing_search
|
||||
elif server in ('auto', 'google'):
|
||||
|
|
@ -1302,6 +1302,10 @@ def search_search_engine(self, br, testing, log, abort, title, authors, identifi
|
|||
log('Skipping non-book result:', result)
|
||||
if not matches:
|
||||
log('No search engine results for terms:', ' '.join(terms))
|
||||
if urlproc is se.google_url_processor:
|
||||
# Google does not cache adult titles
|
||||
log('Trying the bing search engine instead')
|
||||
return self.search_search_engine(br, testing, log, abort, title, authors, identifiers, timeout, 'bing')
|
||||
return matches, terms, domain, urlproc
|
||||
# }}}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue