mirror of
https://github.com/searx/searx
synced 2024-12-12 08:46:26 +01:00
Update path to wikidata image
This commit is contained in:
parent
686a9428d4
commit
acaef6600e
@ -54,7 +54,7 @@ value_xpath = './/div[contains(@class,"wikibase-statementview-mainsnak")]'\
|
|||||||
+ '/*/div[contains(@class,"wikibase-snakview-value")]'
|
+ '/*/div[contains(@class,"wikibase-snakview-value")]'
|
||||||
language_fallback_xpath = '//sup[contains(@class,"wb-language-fallback-indicator")]'
|
language_fallback_xpath = '//sup[contains(@class,"wb-language-fallback-indicator")]'
|
||||||
calendar_name_xpath = './/sup[contains(@class,"wb-calendar-name")]'
|
calendar_name_xpath = './/sup[contains(@class,"wb-calendar-name")]'
|
||||||
|
media_xpath = value_xpath + '//div[contains(@class,"commons-media-caption")]//a'
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
params['url'] = url_search.format(
|
params['url'] = url_search.format(
|
||||||
@ -313,7 +313,7 @@ def add_image(result):
|
|||||||
for property_id in property_ids:
|
for property_id in property_ids:
|
||||||
image = result.xpath(property_xpath.replace('{propertyid}', property_id))
|
image = result.xpath(property_xpath.replace('{propertyid}', property_id))
|
||||||
if image:
|
if image:
|
||||||
image_name = image[0].xpath(value_xpath)
|
image_name = image[0].xpath(media_xpath)
|
||||||
image_src = url_image.replace('{filename}', extract_text(image_name[0]))
|
image_src = url_image.replace('{filename}', extract_text(image_name[0]))
|
||||||
return image_src
|
return image_src
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user