Skip to content

Commit

Permalink
Dont use google webcache as google has discontinued it
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Sep 25, 2024
1 parent 4c3a160 commit b13307a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/calibre/ebooks/metadata/sources/search_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from calibre.utils.lock import ExclusiveFile
from calibre.utils.random_ua import accept_header_for_ua

current_version = (1, 2, 5)
current_version = (1, 2, 6)
minimum_calibre_version = (2, 80, 0)
webcache = {}
webcache_lock = Lock()
Expand Down Expand Up @@ -289,6 +289,7 @@ def google_cache_url_for_url(url):


def google_get_cached_url(url, br=None, log=prints, timeout=60):
# Google's webcache was discontinued in september 2024
cached_url = google_cache_url_for_url(url)
br = google_specialize_browser(br or browser())
try:
Expand Down Expand Up @@ -327,8 +328,7 @@ def google_parse_results(root, raw, log=prints, ignore_uncached=True):
if curl in seen:
continue
seen.add(curl)
cached_url = google_cache_url_for_url(curl)
ans.append(Result(a.get('href'), title, cached_url))
ans.append(Result(a.get('href'), title, curl))
if not ans:
title = ' '.join(root.xpath('//title/text()'))
log('Failed to find any results on results page, with title:', title)
Expand Down Expand Up @@ -413,7 +413,7 @@ def google_develop(search_terms='1423146786', raw_from=''):


def get_cached_url(url, br=None, log=prints, timeout=60):
return google_get_cached_url(url, br, log, timeout) or wayback_machine_cached_url(url, br, log, timeout)
return wayback_machine_cached_url(url, br, log, timeout)


def get_data_for_cached_url(url):
Expand Down

0 comments on commit b13307a

Please sign in to comment.