summaryrefslogtreecommitdiff
path: root/searx/engines/gigablast.py
diff options
context:
space:
mode:
authormarc <a01200356@itesm.mx>2016-12-28 23:24:56 -0600
committermarc <a01200356@itesm.mx>2016-12-29 01:55:30 -0600
commit1175b3906f801c2ad3b6aa1f0718aedd7811dd5f (patch)
tree54ad08f8e7a4bbbb101c732efb1df872c4ceadd6 /searx/engines/gigablast.py
parent7388067f1546f560830a25d0082c0ab9fc1cba34 (diff)
downloadsearxng-1175b3906f801c2ad3b6aa1f0718aedd7811dd5f.tar.gz
searxng-1175b3906f801c2ad3b6aa1f0718aedd7811dd5f.zip
change language list to only include languages with a minimum of engines
that support them. users can still query lesser supported through the :lang_code bang.
Diffstat (limited to 'searx/engines/gigablast.py')
-rw-r--r--searx/engines/gigablast.py9
1 files changed, 7 insertions, 2 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