mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Update the date in the Google consent cookie
This commit is contained in:
parent
4c68fafd41
commit
c67412e1cf
@ -46,7 +46,7 @@ def imgurl_from_id(raw, tbnid):
|
|||||||
class GoogleImages(Source):
|
class GoogleImages(Source):
|
||||||
|
|
||||||
name = 'Google Images'
|
name = 'Google Images'
|
||||||
version = (1, 0, 4)
|
version = (1, 0, 5)
|
||||||
minimum_calibre_version = (2, 80, 0)
|
minimum_calibre_version = (2, 80, 0)
|
||||||
description = _('Downloads covers from a Google Image search. Useful to find larger/alternate covers.')
|
description = _('Downloads covers from a Google Image search. Useful to find larger/alternate covers.')
|
||||||
capabilities = frozenset(['cover'])
|
capabilities = frozenset(['cover'])
|
||||||
@ -107,7 +107,11 @@ class GoogleImages(Source):
|
|||||||
log('Search URL: ' + url)
|
log('Search URL: ' + url)
|
||||||
# See https://github.com/benbusby/whoogle-search/pull/1054 for cookies
|
# See https://github.com/benbusby/whoogle-search/pull/1054 for cookies
|
||||||
br.set_simple_cookie('CONSENT', 'PENDING+987', '.google.com', path='/')
|
br.set_simple_cookie('CONSENT', 'PENDING+987', '.google.com', path='/')
|
||||||
br.set_simple_cookie('SOCS','CAESHAgBEhJnd3NfMjAyMzA4MTAtMF9SQzIaAmRlIAEaBgiAo_CmBg', '.google.com', path='/')
|
template = b'\x08\x01\x128\x08\x14\x12+boq_identityfrontenduiserver_20231107.05_p0\x1a\x05en-US \x03\x1a\x06\x08\x80\xf1\xca\xaa\x06'
|
||||||
|
from datetime import date
|
||||||
|
from base64 import standard_b64encode
|
||||||
|
template.replace(b'20231107', date.today().strftime('%Y%m%d').encode('ascii'))
|
||||||
|
br.set_simple_cookie('SOCS', standard_b64encode(template).decode('ascii').rstrip('='), '.google.com', path='/')
|
||||||
# br.set_debug_http(True)
|
# br.set_debug_http(True)
|
||||||
raw = clean_ascii_chars(br.open(url).read().decode('utf-8'))
|
raw = clean_ascii_chars(br.open(url).read().decode('utf-8'))
|
||||||
# with open('/t/raw.html', 'w') as f:
|
# with open('/t/raw.html', 'w') as f:
|
||||||
|
@ -27,7 +27,7 @@ from calibre.ebooks.chardet import xml_to_unicode
|
|||||||
from calibre.utils.lock import ExclusiveFile
|
from calibre.utils.lock import ExclusiveFile
|
||||||
from calibre.utils.random_ua import accept_header_for_ua
|
from calibre.utils.random_ua import accept_header_for_ua
|
||||||
|
|
||||||
current_version = (1, 2, 3)
|
current_version = (1, 2, 4)
|
||||||
minimum_calibre_version = (2, 80, 0)
|
minimum_calibre_version = (2, 80, 0)
|
||||||
webcache = {}
|
webcache = {}
|
||||||
webcache_lock = Lock()
|
webcache_lock = Lock()
|
||||||
@ -370,7 +370,11 @@ def google_specialize_browser(br):
|
|||||||
if not hasattr(br, 'google_consent_cookie_added'):
|
if not hasattr(br, 'google_consent_cookie_added'):
|
||||||
# See https://github.com/benbusby/whoogle-search/pull/1054 for cookies
|
# See https://github.com/benbusby/whoogle-search/pull/1054 for cookies
|
||||||
br.set_simple_cookie('CONSENT', 'PENDING+987', '.google.com', path='/')
|
br.set_simple_cookie('CONSENT', 'PENDING+987', '.google.com', path='/')
|
||||||
br.set_simple_cookie('SOCS','CAESHAgBEhJnd3NfMjAyMzA4MTAtMF9SQzIaAmRlIAEaBgiAo_CmBg', '.google.com', path='/')
|
template = b'\x08\x01\x128\x08\x14\x12+boq_identityfrontenduiserver_20231107.05_p0\x1a\x05en-US \x03\x1a\x06\x08\x80\xf1\xca\xaa\x06'
|
||||||
|
from datetime import date
|
||||||
|
from base64 import standard_b64encode
|
||||||
|
template.replace(b'20231107', date.today().strftime('%Y%m%d').encode('ascii'))
|
||||||
|
br.set_simple_cookie('SOCS', standard_b64encode(template).decode('ascii').rstrip('='), '.google.com', path='/')
|
||||||
br.google_consent_cookie_added = True
|
br.google_consent_cookie_added = True
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user