diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2020-01-03 14:30:53 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-01-03 14:30:53 +0100 |
commit | 51b9295b84079776e3ea08971ccb3ac159e37477 (patch) | |
tree | 862d88f07cd975a8be0f05ea76b85191f49ed1ae /searx/engines/ina.py | |
parent | f602cb8e4dde214d51216fb547eb4dfdee32e191 (diff) | |
parent | 17b6faa4c3c1cf14a327f4a3538fc70dce08b756 (diff) | |
download | searxng-51b9295b84079776e3ea08971ccb3ac159e37477.tar.gz searxng-51b9295b84079776e3ea08971ccb3ac159e37477.zip |
Merge branch 'master' of https://github.com/asciimoo/searx into add-docs
Diffstat (limited to 'searx/engines/ina.py')
-rw-r--r-- | searx/engines/ina.py | 9 |
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('/') |