diff options
-rw-r--r-- | src/downloader/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/downloader/__init__.py b/src/downloader/__init__.py index 3a02ebe..f256ddc 100644 --- a/src/downloader/__init__.py +++ b/src/downloader/__init__.py | |||
@@ -106,3 +106,23 @@ class WikimediaAPI(): | |||
106 | "list": "recentchanges", | 106 | "list": "recentchanges", |
107 | "rcnamespace": WikimediaAPI.RCNAMESPACES_CODES[namespace], | 107 | "rcnamespace": WikimediaAPI.RCNAMESPACES_CODES[namespace], |
108 | }) | 108 | }) |
109 | |||
110 | def get_geo_pages(self, lat, long, radius, limit=500, namespace="(Main)"): | ||
111 | """ | ||
112 | Generate the query URL performing a geographic search of articles | ||
113 | located near the given coordinates. | ||
114 | |||
115 | :param lat: Latitude | ||
116 | :param long: Longitude | ||
117 | :param radius: radius (in m) to look inside | ||
118 | :param limit: maximum number of results (max 500) | ||
119 | :param namespace: namespace to restrict the search in | ||
120 | :return: | ||
121 | """ | ||
122 | return self.gen_query_url({ | ||
123 | "list": "geosearch", | ||
124 | "gscoord": "%f|%f" % (lat, long), | ||
125 | "gsradius": "%f" % radius, | ||
126 | "gsnamespace": WikimediaAPI.RCNAMESPACES_CODES[namespace], | ||
127 | "gslimit": limit, | ||
128 | }) | ||