mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 17:50:29 +00:00
Merge pull request #1303 from MarcAbonce/bing
Fix bing "garbage" results
This commit is contained in:
commit
d51732c0e5
2 changed files with 6 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
||||||
from lxml import html
|
from lxml import html
|
||||||
from searx.engines.xpath import extract_text
|
from searx.engines.xpath import extract_text
|
||||||
from searx.url_utils import urlencode
|
from searx.url_utils import urlencode
|
||||||
from searx.utils import match_language
|
from searx.utils import match_language, gen_useragent
|
||||||
|
|
||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['general']
|
categories = ['general']
|
||||||
|
@ -43,6 +43,9 @@ def request(query, params):
|
||||||
offset=offset)
|
offset=offset)
|
||||||
|
|
||||||
params['url'] = base_url + search_path
|
params['url'] = base_url + search_path
|
||||||
|
|
||||||
|
params['headers']['User-Agent'] = gen_useragent('Windows NT 6.3; WOW64')
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,9 @@ blocked_tags = ('script',
|
||||||
'style')
|
'style')
|
||||||
|
|
||||||
|
|
||||||
def gen_useragent():
|
def gen_useragent(os=None):
|
||||||
# TODO
|
# 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():
|
def searx_useragent():
|
||||||
|
|
Loading…
Reference in a new issue