commit: 01c2eeb8ff055cfecdb8f1b38f284e95c483d5d9
parent: 3854703d952d22257841f4f6d85921a340c72da5
Author: Adam Tauber <asciimoo@gmail.com>
Date: Fri, 21 Mar 2014 16:36:13 +0100
[fix] indexing ++ url extraction
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py
@@ -47,8 +47,11 @@ def response(resp):
dom = html.fromstring(resp.text)
for result in dom.xpath(results_xpath):
- url = parse_url(extract_url(result.xpath(url_xpath), search_url))
- title = extract_text(result.xpath(title_xpath)[0])
+ try:
+ url = parse_url(extract_url(result.xpath(url_xpath), search_url))
+ title = extract_text(result.xpath(title_xpath)[0])
+ except:
+ continue
content = extract_text(result.xpath(content_xpath)[0])
results.append({'url': url, 'title': title, 'content': content})