summaryrefslogtreecommitdiff
path: root/searx/engines/bing_images.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-03-01 08:01:36 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2020-03-01 08:01:36 +0100
commite0c99d9dcbe4c2eee0a7c6f4a7326a8376467640 (patch)
treefb5397b6e1c12469533b0cf40d0ab3e657b7e7a8 /searx/engines/bing_images.py
parent40843fe95ada52bc8791b4706392bda5afecf32e (diff)
downloadsearxng-e0c99d9dcbe4c2eee0a7c6f4a7326a8376467640.tar.gz
searxng-e0c99d9dcbe4c2eee0a7c6f4a7326a8376467640.zip
bugfix: fetch_supported_languages bing, -news, -videos, -images
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/bing_images.py')
-rw-r--r--searx/engines/bing_images.py21
1 files changed, 2 insertions, 19 deletions
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index 44e2c3bbc..138ed11c6 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -18,6 +18,8 @@ import re
from searx.url_utils import urlencode
from searx.utils import match_language
+from searx.engines.bing import _fetch_supported_languages, supported_languages_url, language_aliases
+
# engine dependent config
categories = ['images']
paging = True
@@ -103,22 +105,3 @@ def response(resp):
continue
return results
-
-
-# get supported languages from their site
-def _fetch_supported_languages(resp):
- supported_languages = []
- dom = html.fromstring(resp.text)
-
- regions_xpath = '//div[@id="region-section-content"]' \
- + '//ul[@class="b_vList"]/li/a/@href'
-
- regions = dom.xpath(regions_xpath)
- for region in regions:
- code = re.search('setmkt=[^\&]+', region).group()[7:]
- if code == 'nb-NO':
- code = 'no-NO'
-
- supported_languages.append(code)
-
- return supported_languages