mirror of
https://github.com/benbusby/whoogle-search.git
synced 2025-07-09 03:04:13 -04:00
Force using Lynx UA for all searches
This is a possible fix for the recent removal of javascript-free search results by Google. Forcing the Lynx user agent to be used for all searches returns search results, although they're formatted a bit differently than before. If this proves to be a long term fix, styling can be fixed at a later date. See #1211
This commit is contained in:
parent
36d8268643
commit
6f1e1e6847
@ -18,6 +18,7 @@ AUTOCOMPLETE_URL = ('https://suggestqueries.google.com/'
|
||||
|
||||
MOBILE_UA = '{}/5.0 (Android 0; Mobile; rv:54.0) Gecko/54.0 {}/59.0'
|
||||
DESKTOP_UA = '{}/5.0 (X11; {} x86_64; rv:75.0) Gecko/20100101 {}/75.0'
|
||||
LYNX_UA = 'Lynx/2.9.2 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/3.4.0'
|
||||
|
||||
# Valid query params
|
||||
VALID_PARAMS = ['tbs', 'tbm', 'start', 'near', 'source', 'nfpr']
|
||||
@ -73,6 +74,11 @@ def send_tor_signal(signal: Signal) -> bool:
|
||||
|
||||
|
||||
def gen_user_agent(is_mobile) -> str:
|
||||
if True:
|
||||
# Temporary fix while the removal of javascript-free searches by
|
||||
# Google is being investigated
|
||||
return LYNX_UA
|
||||
|
||||
user_agent = os.environ.get('WHOOGLE_USER_AGENT', '')
|
||||
user_agent_mobile = os.environ.get('WHOOGLE_USER_AGENT_MOBILE', '')
|
||||
if user_agent and not is_mobile:
|
||||
@ -308,7 +314,7 @@ class Request:
|
||||
now = datetime.now()
|
||||
cookies = {
|
||||
'CONSENT': 'PENDING+987',
|
||||
'SOCS': 'CAESHAgBEhIaAB',
|
||||
'SOCS': 'CAESHAgBEhIaAB',
|
||||
}
|
||||
|
||||
# Validate Tor conn and request new identity if the last one failed
|
||||
|
Loading…
x
Reference in New Issue
Block a user