summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlice Ferrazzi <alice.ferrazzi@gmail.com>2018-08-19 10:22:04 +0900
committerAlice Ferrazzi <alice.ferrazzi@gmail.com>2018-08-21 22:55:39 +0900
commitff2eac9f6b382e8ad30eed2b733740ce4a50f6e6 (patch)
tree43d9c7d79a34b185dfbf6b0b579e7037dcd5625e /searx/engines
parent5f0888b8f4f7a46a7418e6faf34d47d45adca1c7 (diff)
downloadsearxng-ff2eac9f6b382e8ad30eed2b733740ce4a50f6e6.tar.gz
searxng-ff2eac9f6b382e8ad30eed2b733740ce4a50f6e6.zip
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.
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/gentoo.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/searx/engines/gentoo.py b/searx/engines/gentoo.py
index 3611068d3..39568a148 100644
--- a/searx/engines/gentoo.py
+++ b/searx/engines/gentoo.py
@@ -4,7 +4,7 @@
Gentoo Wiki
@website https://wiki.gentoo.org
- @provide-api no (Mediawiki provides API, but Arch Wiki blocks access to it
+ @provide-api yes
@using-api no
@results HTML
@stable no (HTML can change)
@@ -35,18 +35,23 @@ def locale_to_lang_code(locale):
# wikis for some languages were moved off from the main site, we need to make
# requests to correct URLs to be able to get results in those languages
-lang_urls = {
+lang_urls= {
'en': {
'base': 'https://wiki.gentoo.org',
- 'search': '/index.php?title=Special:Search&offset={offset}&{query}&profile=translation&languagefilter={language}'
+ 'search': '/index.php?title=Special:Search&offset={offset}&{query}'
+ },
+ 'others': {
+ 'base': 'https://wiki.gentoo.org',
+ 'search': '/index.php?title=Special:Search&offset={offset}&{query}\
+ &profile=translation&languagefilter={language}'
}
}
# get base & search URLs for selected language
def get_lang_urls(language):
- if language in lang_urls:
- return lang_urls[language]
+ if language != 'en':
+ return lang_urls['others']
return lang_urls['en']