on master help sign in
Fix choosing languges function

Searching for english is now giving all pages results. Instead searching for a specific language different from english is correctly returning only translated pages for the selected language.

commitff2eac9f6b382e8ad30eed2b733740ce4a50f6e6 authorAlice Ferrazzi <alice.ferrazzi@gmail.com> dateSun 19 Aug 2018, 10:22 (8 years ago) parent5f0888b
1 file changed+10−5
searx/engines/gentoo.py+10−5
searx/engines/gentoo.py+10−5
@@ -4,7 +4,7 @@
44 Gentoo Wiki
55
66 @website https://wiki.gentoo.org
7− @provide-api no (Mediawiki provides API, but Arch Wiki blocks access to it
7+ @provide-api yes
88 @using-api no
99 @results HTML
1010 @stable no (HTML can change)
@@ -35,18 +35,23 @@ def locale_to_lang_code(locale):
3535
3636# wikis for some languages were moved off from the main site, we need to make
3737# requests to correct URLs to be able to get results in those languages
38−lang_urls = {
38+lang_urls= {
3939 'en': {
4040 'base': 'https://wiki.gentoo.org',
41− 'search': '/index.php?title=Special:Search&offset={offset}&{query}&profile=translation&languagefilter={language}'
41+ 'search': '/index.php?title=Special:Search&offset={offset}&{query}'
42+ },
43+ 'others': {
44+ 'base': 'https://wiki.gentoo.org',
45+ 'search': '/index.php?title=Special:Search&offset={offset}&{query}\
46+ &profile=translation&languagefilter={language}'
4247 }
4348}
4449
4550
4651# get base & search URLs for selected language
4752def get_lang_urls(language):
48− if language in lang_urls:
49− return lang_urls[language]
53+ if language != 'en':
54+ return lang_urls['others']
5055 return lang_urls['en']
5156
5257