@@ -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:
90− if int(article_id) < 0:
91+ if int(article_id) < 0 or 'disambiguation' in page.get('pageprops', {}):
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')
101 summary = extract_first_paragraph(extract, title, image)
102 summary = extract_first_paragraph(extract, title, image)
103+ summary = summary.replace('() ', '')
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'])) \