summaryrefslogtreecommitdiff
path: root/searx/engines/bing_images.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2020-04-29 12:02:39 +0000
committerGitHub <noreply@github.com>2020-04-29 12:02:39 +0000
commit0f4dbc4eca848d910fb4433e3d1c61fa7fcfa8de (patch)
treed3b37c89b57aca471cddecaea44f8e9218cc487f /searx/engines/bing_images.py
parent678d41d75bcdf14b17fa13f69aa323a9f8716faa (diff)
parent7342806987aec05c50f12e149683609640ba66a0 (diff)
Merge branch 'master' into uwsgi_static
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