logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 75b276f408487db8fecc6eab7abd6126323a7efe
parent b25dccd1ae818ed7fe27b3f6dfb80a755599ab12
Author: Marc Abonce Seguin <marc-abonce@mailbox.org>
Date:   Sun, 20 May 2018 18:10:22 -0500

fix bing "garbage" results (issue #1275)

Diffstat:

Msearx/engines/bing.py5++++-
Msearx/utils.py4++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/searx/engines/bing.py b/searx/engines/bing.py @@ -16,7 +16,7 @@ from lxml import html from searx.engines.xpath import extract_text from searx.url_utils import urlencode -from searx.utils import match_language +from searx.utils import match_language, gen_useragent # engine dependent config categories = ['general'] @@ -43,6 +43,9 @@ def request(query, params): offset=offset) params['url'] = base_url + search_path + + params['headers']['User-Agent'] = gen_useragent('Windows NT 6.3; WOW64') + return params diff --git a/searx/utils.py b/searx/utils.py @@ -57,9 +57,9 @@ blocked_tags = ('script', 'style') -def gen_useragent(): +def gen_useragent(os=None): # TODO - return ua.format(os=choice(ua_os), version=choice(ua_versions)) + return ua.format(os=os or choice(ua_os), version=choice(ua_versions)) def searx_useragent():