summaryrefslogtreecommitdiff
path: root/searx/engines/yahoo_news.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-03-18 13:19:50 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-03-18 13:19:50 +0100
commit337bd6d907503176eb94290c3f386ce88167dea8 (patch)
tree384625d82b868329252f549992aee4f64d8a2566 /searx/engines/yahoo_news.py
parentfd86bf8189683aee72b934c8dd7544aa362a0728 (diff)
downloadsearxng-337bd6d907503176eb94290c3f386ce88167dea8.tar.gz
searxng-337bd6d907503176eb94290c3f386ce88167dea8.zip
simplify datetime extraction
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..53c8b07a7 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)