diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-12-29 10:41:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-29 10:41:14 +0100 |
| commit | d08108be6293c8764f0d1d950a7aab283cddffed (patch) | |
| tree | 8c56885e21ec92109bfaaadca2af3a43b5f7c11d /searx/engines | |
| parent | 7388067f1546f560830a25d0082c0ab9fc1cba34 (diff) | |
| parent | 896c0c3734ae369eca4ba9592595e1b5395dbc88 (diff) | |
Merge pull request #794 from a01200356/languages
Changes in search language list (continuation of #748)
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/gigablast.py | 9 | ||||
| -rw-r--r-- | searx/engines/wikipedia.py | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 827b9cd03..0c1d7f613 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -95,8 +95,13 @@ def _fetch_supported_languages(resp): dom = fromstring(resp.text) links = dom.xpath('//span[@id="menu2"]/a') for link in links: - code = link.xpath('./@href')[0][-2:] - if code != 'xx' and code not in supported_languages: + href = link.xpath('./@href')[0].split('lang%3A') + if len(href) == 2: + code = href[1].split('_') + if len(code) == 2: + code = code[0] + '-' + code[1].upper() + else: + code = code[0] supported_languages.append(code) return supported_languages diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index 78acd349d..3af8f1c71 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -132,7 +132,7 @@ def _fetch_supported_languages(resp): english_name = td[1].xpath('./a')[0].text articles = int(td[4].xpath('./a/b')[0].text.replace(',', '')) # exclude languages with too few articles - if articles >= 100000: + if articles >= 100: supported_languages[code] = {"name": name, "english_name": english_name, "articles": articles} return supported_languages |