|
@@ -27,10 +27,10 @@ base_url = 'https://{language}.wikipedia.org/'
|
27
|
27
|
search_postfix = 'w/api.php?action=query'\
|
28
|
28
|
'&list=search'\
|
29
|
29
|
'&{query}'\
|
30
|
|
- '&srprop=timestamp'\
|
31
|
30
|
'&format=json'\
|
32
|
31
|
'&sroffset={offset}'\
|
33
|
|
- '&srlimit={limit}'
|
|
32
|
+ '&srlimit={limit}'\
|
|
33
|
+ '&srwhat=nearmatch' # search for a near match in the title
|
34
|
34
|
|
35
|
35
|
|
36
|
36
|
# do search-request
|
|
@@ -74,6 +74,8 @@ def response(resp):
|
74
|
74
|
|
75
|
75
|
# parse results
|
76
|
76
|
for result in search_results['query']['search']:
|
|
77
|
+ if result.get('snippet', '').startswith('#REDIRECT'):
|
|
78
|
+ continue
|
77
|
79
|
url = base_url.format(language=resp.search_params['language']) +\
|
78
|
80
|
'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8'))
|
79
|
81
|
|