on master help sign in
Update path to wikidata image

commitacaef6600e34159d2edb7bf0ef6b5f34471136e1 authorLéo Bourrel <leo.bourrel@epitech.eu> dateThu 5 Jul 2018, 10:11 (8 years ago) parent686a942
1 file changed+2−2
searx/engines/wikidata.py+2−2
searx/engines/wikidata.py+2−2
@@ -54,7 +54,7 @@ value_xpath = './/div[contains(@class,"wikibase-statementview-mainsnak")]'\
5454 + '/*/div[contains(@class,"wikibase-snakview-value")]'
5555language_fallback_xpath = '//sup[contains(@class,"wb-language-fallback-indicator")]'
5656calendar_name_xpath = './/sup[contains(@class,"wb-calendar-name")]'
57−
57+media_xpath = value_xpath + '//div[contains(@class,"commons-media-caption")]//a'
5858
5959def request(query, params):
6060 params['url'] = url_search.format(
@@ -313,7 +313,7 @@ def add_image(result):
313313 for property_id in property_ids:
314314 image = result.xpath(property_xpath.replace('{propertyid}', property_id))
315315 if image:
316− image_name = image[0].xpath(value_xpath)
316+ image_name = image[0].xpath(media_xpath)
317317 image_src = url_image.replace('{filename}', extract_text(image_name[0]))
318318 return image_src
319319