diff --git a/src/calibre/ebooks/metadata/sources/google.py b/src/calibre/ebooks/metadata/sources/google.py index 7c8af1caea..df630bb484 100644 --- a/src/calibre/ebooks/metadata/sources/google.py +++ b/src/calibre/ebooks/metadata/sources/google.py @@ -202,7 +202,7 @@ def to_metadata(browser, log, entry_, timeout, running_a_test=False): # {{{ class GoogleBooks(Source): name = 'Google' - version = (1, 1, 2) + version = (1, 1, 3) minimum_calibre_version = (2, 80, 0) description = _('Downloads metadata and covers from Google Books') @@ -447,7 +447,7 @@ class GoogleBooks(Source): purl = urlparse(q.url) except Exception: continue - if not purl.hostname.startswith('https://books.google'): + if not purl.hostname.startswith('books.google'): continue google_ids.append(m.group(1)) @@ -586,6 +586,6 @@ if __name__ == '__main__': # tests {{{ ]), ] - test_identify_plugin(GoogleBooks.name, tests[:]) + test_identify_plugin(GoogleBooks.name, tests[-1:]) # }}} diff --git a/src/calibre/srv/auto_reload.py b/src/calibre/srv/auto_reload.py index 3200be4597..ccae8228ff 100644 --- a/src/calibre/srv/auto_reload.py +++ b/src/calibre/srv/auto_reload.py @@ -323,7 +323,7 @@ class Worker: s.settimeout(5) try: if self.uses_ssl: - s = ssl.wrap_socket(s) + s = ssl.create_default_context().wrap_socket(s) s.connect(('localhost', self.port)) return except OSError: diff --git a/src/calibre/web/site_parsers/nytimes.py b/src/calibre/web/site_parsers/nytimes.py index 2526bf2df6..870368f474 100644 --- a/src/calibre/web/site_parsers/nytimes.py +++ b/src/calibre/web/site_parsers/nytimes.py @@ -9,7 +9,7 @@ from xml.sax.saxutils import escape, quoteattr from calibre.utils.iso8601 import parse_iso8601 -module_version = 15 # needed for live updates +module_version = 16 # needed for live updates pprint @@ -52,9 +52,15 @@ def parse_vid(v): yield f'
{v["promotionalSummary"]}
' +def get_data_wrapper(html: str | None) -> str: + m = re.search(r'datawrapper.dwcdn.net/(.{5})', html or '') + if m is not None: + return m.group(1) + return '' + + def parse_emb(e): - if e.get('html') and 'datawrapper.dwcdn.net' in e.get('html', ''): - dw = re.search(r'datawrapper.dwcdn.net/(.{5})', e['html']).group(1) + if dw := get_data_wrapper(e.get('html')): yield f'
' elif e.get('promotionalMedia'): if e.get('headline'):