summaryrefslogtreecommitdiff
path: root/searx/engines/yahoo_news.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-03-18 18:20:10 +0100
committerAdam Tauber <asciimoo@gmail.com>2014-03-18 18:20:10 +0100
commit018a14431bd3612db4e8840ce24f3e60026ece0f (patch)
tree18c7f0ed489c0c0f206ac1f0a191b1ce0ab045b2 /searx/engines/yahoo_news.py
parentfaed14b2c691746ba6cf98d164a5e6b1ca3ee4c9 (diff)
parent993271bed30e24c7ae1e0f63b64e030829206f27 (diff)
Merge pull request #57 from pointhi/results
improving publishDate extraction and output of it
Diffstat (limited to 'searx/engines/yahoo_news.py')
-rw-r--r--searx/engines/yahoo_news.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py
index a1e9df59c..43da93ede 100644
--- a/searx/engines/yahoo_news.py
+++ b/searx/engines/yahoo_news.py
@@ -6,6 +6,7 @@ from searx.engines.xpath import extract_text, extract_url
from searx.engines.yahoo import parse_url
from datetime import datetime, timedelta
import re
+from dateutil import parser
categories = ['news']
search_url = 'http://news.search.yahoo.com/search?{query}&b={offset}'
@@ -52,9 +53,7 @@ def response(resp):
- timedelta(hours=int(timeNumbers[0]))\
- timedelta(minutes=int(timeNumbers[1]))
else:
- # TODO year in string possible?
- publishedDate = datetime.strptime(publishedDate,
- "%b %d %H:%M%p")
+ publishedDate = parser.parse(publishedDate)
if publishedDate.year == 1900:
publishedDate = publishedDate.replace(year=datetime.now().year)