diff options
author | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-18 13:19:50 +0100 |
---|---|---|
committer | Thomas Pointhuber <thomas.pointhuber@gmx.at> | 2014-03-18 13:19:50 +0100 |
commit | 337bd6d907503176eb94290c3f386ce88167dea8 (patch) | |
tree | 384625d82b868329252f549992aee4f64d8a2566 /searx/engines/google_news.py | |
parent | fd86bf8189683aee72b934c8dd7544aa362a0728 (diff) | |
download | searxng-337bd6d907503176eb94290c3f386ce88167dea8.tar.gz searxng-337bd6d907503176eb94290c3f386ce88167dea8.zip |
simplify datetime extraction
Diffstat (limited to 'searx/engines/google_news.py')
-rw-r--r-- | searx/engines/google_news.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 43ccaa3e3..b8a7be3ee 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -2,6 +2,7 @@ from urllib import urlencode from json import loads +from dateutil import parser from datetime import datetime categories = ['news'] @@ -32,16 +33,9 @@ def response(resp): return [] for result in search_res['responseData']['results']: -# S.149 (159), library.pdf -# datetime.strptime("Mon, 10 Mar 2014 16:26:15 -0700", -# "%a, %d %b %Y %H:%M:%S %z") -# publishedDate = parse(result['publishedDate']) - publishedDate = datetime.strptime( - str.join(' ', result['publishedDate'].split(None)[0:5]), - "%a, %d %b %Y %H:%M:%S") - #utc_offset = timedelta(result['publishedDate'].split(None)[5]) - # local = utc + offset - #publishedDate = publishedDate + utc_offset + +# Mon, 10 Mar 2014 16:26:15 -0700 + publishedDate = parser.parse(result['publishedDate']) results.append({'url': result['unescapedUrl'], 'title': result['titleNoFormatting'], |