summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2019-12-23 12:31:31 +0000
committerGitHub <noreply@github.com>2019-12-23 12:31:31 +0000
commit3e14bf4d2786ce5f2a61684cf16744700e670e60 (patch)
tree3f8262ed3e73fca45f86e9c93c924e442d2094be /searx
parent34ad3d6b34017523a9502f86b92c17fe389918eb (diff)
parent495ae59b31b6aafae484ecdfb6aece3a84f1ede7 (diff)
Merge pull request #1686 from MarcAbonce/wiki_infobox_fixes
Infobox fixes
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/wikipedia.py6
-rw-r--r--searx/webapp.py10
2 files changed, 9 insertions, 7 deletions
diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py
index 690da72fe..a216ba886 100644
--- a/searx/engines/wikipedia.py
+++ b/searx/engines/wikipedia.py
@@ -21,7 +21,8 @@ search_url = base_url + u'w/api.php?'\
'action=query'\
'&format=json'\
'&{query}'\
- '&prop=extracts|pageimages'\
+ '&prop=extracts|pageimages|pageprops'\
+ '&ppprop=disambiguation'\
'&exintro'\
'&explaintext'\
'&pithumbsize=300'\
@@ -87,7 +88,7 @@ def response(resp):
if int(article_id) > 0:
break
- if int(article_id) < 0:
+ if int(article_id) < 0 or 'disambiguation' in page.get('pageprops', {}):
return []
title = page.get('title')
@@ -99,6 +100,7 @@ def response(resp):
extract = page.get('extract')
summary = extract_first_paragraph(extract, title, image)
+ summary = summary.replace('() ', '')
# link to wikipedia article
wikipedia_link = base_url.format(language=url_lang(resp.search_params['language'])) \
diff --git a/searx/webapp.py b/searx/webapp.py
index 7cf4106d3..212c874c9 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -606,11 +606,11 @@ def index():
# HTML output format
# suggestions: use RawTextQuery to get the suggestion URLs with the same bang
- suggestion_urls = map(lambda suggestion: {
- 'url': raw_text_query.changeSearchQuery(suggestion).getFullQuery(),
- 'title': suggestion
- },
- result_container.suggestions)
+ suggestion_urls = list(map(lambda suggestion: {
+ 'url': raw_text_query.changeSearchQuery(suggestion).getFullQuery(),
+ 'title': suggestion
+ },
+ result_container.suggestions))
correction_urls = list(map(lambda correction: {
'url': raw_text_query.changeSearchQuery(correction).getFullQuery(),