mirror of
https://github.com/searxng/searxng.git
synced 2025-03-12 15:41:15 +00:00
[fix] bing fetch engine traits - adjusted XPath selectors
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
01e2b3e325
commit
03419078ef
3 changed files with 6 additions and 6 deletions
|
@ -223,7 +223,7 @@ def fetch_traits(engine_traits: EngineTraits):
|
|||
'da': 'dk', # da --> da-dk
|
||||
}
|
||||
|
||||
for href in eval_xpath(dom, '//div[@id="language-section"]//li/a/@href'):
|
||||
for href in eval_xpath(dom, '//div[@id="language-section-content"]//div[@class="languageItem"]/a/@href'):
|
||||
eng_lang = parse_qs(urlparse(href).query)['setlang'][0]
|
||||
babel_lang = map_lang.get(eng_lang, eng_lang)
|
||||
try:
|
||||
|
@ -253,7 +253,7 @@ def fetch_traits(engine_traits: EngineTraits):
|
|||
map_market_codes = {
|
||||
'zh-hk': 'en-hk', # not sure why, but at M$ this is the market code for Hongkong
|
||||
}
|
||||
for href in eval_xpath(dom, '//div[@id="region-section"]//li/a/@href'):
|
||||
for href in eval_xpath(dom, '//div[@id="region-section-content"]//div[@class="regionItem"]/a/@href'):
|
||||
cc_tag = parse_qs(urlparse(href).query)['cc'][0]
|
||||
if cc_tag == 'clear':
|
||||
engine_traits.all_locale = cc_tag
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
'''List of SearXNG's locale codes.
|
||||
'''List of SearXNG's locale codes used for the search language/region.
|
||||
|
||||
.. hint::
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ from searx.enginelib.traits import EngineTraitsMap
|
|||
languages_file = Path(searx_dir) / 'sxng_locales.py'
|
||||
languages_file_header = """\
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
'''List of SearXNG's locale codes.
|
||||
'''List of SearXNG's locale codes used for the search language/region.
|
||||
|
||||
.. hint::
|
||||
|
||||
|
@ -101,8 +101,8 @@ def fetch_traits_map():
|
|||
def filter_locales(traits_map: EngineTraitsMap):
|
||||
"""Filter language & region tags by a threshold."""
|
||||
|
||||
min_eng_per_region = 18
|
||||
min_eng_per_lang = 20
|
||||
min_eng_per_region = 22
|
||||
min_eng_per_lang = 24
|
||||
|
||||
_ = {}
|
||||
for eng in traits_map.values():
|
||||
|
|
Loading…
Reference in a new issue