@@ -21,7 +21,8 @@ search_url = base_url + u'w/api.php?'\
2121 'action=query'\
2222 '&format=json'\
2323 '&{query}'\
24− '&prop=extracts|pageimages'\
24+ '&prop=extracts|pageimages|pageprops'\
25+ '&ppprop=disambiguation'\
2526 '&exintro'\
2627 '&explaintext'\
2728 '&pithumbsize=300'\
@@ -87,7 +88,7 @@ def response(resp):
8788 if int(article_id) > 0:
8889 break
8990
90− if int(article_id) < 0:
91+ if int(article_id) < 0 or 'disambiguation' in page.get('pageprops', {}):
9192 return []
9293
9394 title = page.get('title')
@@ -99,6 +100,7 @@ def response(resp):
99100 extract = page.get('extract')
100101
101102 summary = extract_first_paragraph(extract, title, image)
103+ summary = summary.replace('() ', '')
102104
103105 # link to wikipedia article
104106 wikipedia_link = base_url.format(language=url_lang(resp.search_params['language'])) \