|
@@ -0,0 +1,15 @@
|
|
1
|
+from json import loads
|
|
2
|
+
|
|
3
|
+def request(query, params):
|
|
4
|
+ params['url'] = 'http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=%s&srprop=timestamp&format=json' % query
|
|
5
|
+
|
|
6
|
+ return params
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+def response(resp):
|
|
10
|
+ search_results = loads(resp.text)
|
|
11
|
+ results = []
|
|
12
|
+ for res in search_results.get('query', {}).get('search', []):
|
|
13
|
+ results.append({'url': 'https://en.wikipedia.org/wiki/%s' % res['title'], 'title': res['title']})
|
|
14
|
+ return results
|
|
15
|
+
|