on master help sign in
Merge branch 'master' into makefile-doc
07c8ca8Markus Heiser
searx/engines/wikipedia.py+4−2
@@ -21,7 +21,8 @@ search_url = base_url + u'w/api.php?'\
21 'action=query'\
21 'action=query'\
22 '&format=json'\
22 '&format=json'\
23 '&{query}'\
23 '&{query}'\
24− '&prop=extracts|pageimages'\
24+ '&prop=extracts|pageimages|pageprops'\
25+ '&ppprop=disambiguation'\
25 '&exintro'\
26 '&exintro'\
26 '&explaintext'\
27 '&explaintext'\
27 '&pithumbsize=300'\
28 '&pithumbsize=300'\
@@ -87,7 +88,7 @@ def response(resp):
87 if int(article_id) > 0:
88 if int(article_id) > 0:
88 break
89 break
89
90
90− if int(article_id) < 0:
91+ if int(article_id) < 0 or 'disambiguation' in page.get('pageprops', {}):
91 return []
92 return []
92
93
93 title = page.get('title')
94 title = page.get('title')
@@ -99,6 +100,7 @@ def response(resp):
99 extract = page.get('extract')
100 extract = page.get('extract')
100
101
101 summary = extract_first_paragraph(extract, title, image)
102 summary = extract_first_paragraph(extract, title, image)
103+ summary = summary.replace('() ', '')
102
104
103 # link to wikipedia article
105 # link to wikipedia article
104 wikipedia_link = base_url.format(language=url_lang(resp.search_params['language'])) \
106 wikipedia_link = base_url.format(language=url_lang(resp.search_params['language'])) \
searx/webapp.py+5−5
@@ -606,11 +606,11 @@ def index():
606 # HTML output format
606 # HTML output format
607
607
608 # suggestions: use RawTextQuery to get the suggestion URLs with the same bang
608 # suggestions: use RawTextQuery to get the suggestion URLs with the same bang
609− suggestion_urls = map(lambda suggestion: {
609+ suggestion_urls = list(map(lambda suggestion: {
610− 'url': raw_text_query.changeSearchQuery(suggestion).getFullQuery(),
610+ 'url': raw_text_query.changeSearchQuery(suggestion).getFullQuery(),
611− 'title': suggestion
611+ 'title': suggestion
612− },
612+ },
613− result_container.suggestions)
613+ result_container.suggestions))
614
614
615 correction_urls = list(map(lambda correction: {
615 correction_urls = list(map(lambda correction: {
616 'url': raw_text_query.changeSearchQuery(correction).getFullQuery(),
616 'url': raw_text_query.changeSearchQuery(correction).getFullQuery(),