|
@@ -2,6 +2,7 @@
|
2
|
2
|
|
3
|
3
|
from urllib import urlencode
|
4
|
4
|
from json import loads
|
|
5
|
+from dateutil import parser
|
5
|
6
|
from datetime import datetime
|
6
|
7
|
|
7
|
8
|
categories = ['news']
|
|
@@ -32,16 +33,9 @@ def response(resp):
|
32
|
33
|
return []
|
33
|
34
|
|
34
|
35
|
for result in search_res['responseData']['results']:
|
35
|
|
-# S.149 (159), library.pdf
|
36
|
|
-# datetime.strptime("Mon, 10 Mar 2014 16:26:15 -0700",
|
37
|
|
-# "%a, %d %b %Y %H:%M:%S %z")
|
38
|
|
-# publishedDate = parse(result['publishedDate'])
|
39
|
|
- publishedDate = datetime.strptime(
|
40
|
|
- str.join(' ', result['publishedDate'].split(None)[0:5]),
|
41
|
|
- "%a, %d %b %Y %H:%M:%S")
|
42
|
|
- #utc_offset = timedelta(result['publishedDate'].split(None)[5])
|
43
|
|
- # local = utc + offset
|
44
|
|
- #publishedDate = publishedDate + utc_offset
|
|
36
|
+
|
|
37
|
+# Mon, 10 Mar 2014 16:26:15 -0700
|
|
38
|
+ publishedDate = parser.parse(result['publishedDate'])
|
45
|
39
|
|
46
|
40
|
results.append({'url': result['unescapedUrl'],
|
47
|
41
|
'title': result['titleNoFormatting'],
|