summaryrefslogtreecommitdiff
path: root/searx/engines/ina.py
diff options
context:
space:
mode:
authorMathieu Brunot <mathieu.brunot@monogramm.io>2020-01-14 15:43:43 +0100
committerGitHub <noreply@github.com>2020-01-14 15:43:43 +0100
commit24472ce71832a2b516e0c96fe73587208eb33c65 (patch)
tree830e82e0781c96068110052dafb8047fb8622565 /searx/engines/ina.py
parent359c18f9e633fe4cf1062bb2e7507840065e6ca5 (diff)
parentbda189565589b0065152f5a9fba4565404f9bd9a (diff)
Merge branch 'master' into docker/opencontainers
Diffstat (limited to 'searx/engines/ina.py')
-rw-r--r--searx/engines/ina.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/searx/engines/ina.py b/searx/engines/ina.py
index 37a05f099..ea509649f 100644
--- a/searx/engines/ina.py
+++ b/searx/engines/ina.py
@@ -32,7 +32,7 @@ base_url = 'https://www.ina.fr'
search_url = base_url + '/layout/set/ajax/recherche/result?autopromote=&hf={ps}&b={start}&type=Video&r=&{query}'
# specific xpath variables
-results_xpath = '//div[contains(@class,"search-results--list")]/div[@class="media"]'
+results_xpath = '//div[contains(@class,"search-results--list")]//div[@class="media-body"]'
url_xpath = './/a/@href'
title_xpath = './/h3[@class="h3--title media-heading"]'
thumbnail_xpath = './/img/@src'
@@ -65,8 +65,11 @@ def response(resp):
videoid = result.xpath(url_xpath)[0]
url = base_url + videoid
title = p.unescape(extract_text(result.xpath(title_xpath)))
- thumbnail = extract_text(result.xpath(thumbnail_xpath)[0])
- if thumbnail[0] == '/':
+ try:
+ thumbnail = extract_text(result.xpath(thumbnail_xpath)[0])
+ except:
+ thumbnail = ''
+ if thumbnail and thumbnail[0] == '/':
thumbnail = base_url + thumbnail
d = extract_text(result.xpath(publishedDate_xpath)[0])
d = d.split('/')