summaryrefslogtreecommitdiff
path: root/searx/engines/yahoo_news.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-03-08 19:09:03 +0100
committerAdam Tauber <asciimoo@gmail.com>2014-03-08 19:09:03 +0100
commit0fc481f47ed8116b3acd4dd11c0527994582d526 (patch)
treea8de4b360306e3ed2e555c0f4b20718b4c2a6203 /searx/engines/yahoo_news.py
parentaa9df5bf169448dcc623da173a05ebfc21b69686 (diff)
downloadsearxng-0fc481f47ed8116b3acd4dd11c0527994582d526.tar.gz
searxng-0fc481f47ed8116b3acd4dd11c0527994582d526.zip
[fix] yahoo url extraction
Diffstat (limited to 'searx/engines/yahoo_news.py')
-rw-r--r--searx/engines/yahoo_news.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py
index 3c257866c..35e323917 100644
--- a/searx/engines/yahoo_news.py
+++ b/searx/engines/yahoo_news.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python
from urllib import urlencode
-from urlparse import unquote
from lxml import html
from searx.engines.xpath import extract_text, extract_url
+from searx.engines.yahoo import parse_url
categories = ['news']
search_url = 'http://news.search.yahoo.com/search?{query}&b={offset}'
@@ -34,10 +34,7 @@ def response(resp):
dom = html.fromstring(resp.text)
for result in dom.xpath(results_xpath):
- url_string = extract_url(result.xpath(url_xpath), search_url)
- start = url_string.find('http', url_string.find('/RU=')+1)
- end = url_string.rfind('/RS')
- url = unquote(url_string[start:end])
+ url = parse_url(extract_url(result.xpath(url_xpath), search_url))
title = extract_text(result.xpath(title_xpath)[0])
content = extract_text(result.xpath(content_xpath)[0])
results.append({'url': url, 'title': title, 'content': content})