diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2020-03-04 12:11:58 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-03-04 12:11:58 +0100 |
| commit | 9f1cb7a943cc5a5e26fec753ddeec47bd3580ea0 (patch) | |
| tree | 7b3a571ab8caad931b4cbcdf063bf8b10c715095 /searx/engines/bing_images.py | |
| parent | 3cb7daedb7c5c93a98dfefa191c161f31a1347c6 (diff) | |
| parent | a5d3585a0c47b736b0845fcf6786f0f5b57d4215 (diff) | |
Merge branch 'master' of https://github.com/asciimoo/searx into filtron
Diffstat (limited to 'searx/engines/bing_images.py')
| -rw-r--r-- | searx/engines/bing_images.py | 21 |
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 |