Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1303 from MarcAbonce/bing
Browse files Browse the repository at this point in the history
Fix bing "garbage" results
  • Loading branch information
asciimoo committed Jul 9, 2018
2 parents 736f0ff + 75b276f commit d51732c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion searx/engines/bing.py
Expand Up @@ -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']
Expand All @@ -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


Expand Down
4 changes: 2 additions & 2 deletions searx/utils.py
Expand Up @@ -59,9 +59,9 @@
'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():
Expand Down

0 comments on commit d51732c

Please sign in to comment.