A small package providing methods for retrieving Strava's HTTP cookies needed to download Strava's global heatmap in high resolution.
Project description
stravacookies
stravacookies
is a small python package providing a few classes for retrieving HTTP cookies from Strava web servers.
These cookies allow web browsers to get the high-resolution version of the Global Strava Heatmap. The very same cookies can also be used by cartographic applications (such as JOSM and Cartograph Maps) to get Strava Heatmap tiles via Tile Map Service (TMS).
Permission to use the hi-res Strava Heatmap in JOSM has been granted by Strava, see https://wiki.openstreetmap.org/wiki/Strava and https://wiki.openstreetmap.org/wiki/Permissions/Strava
Requirements
The following python packages are also required, and need to be installed:
colorama
;mechanize
.
To install them, from the command line run:
pip3 install colorama
pip3 install mechanize
A Strava account is required. Facebook/Google/Apple login to Strava is not supported.
How it works
Hi-res Gloval Strava Heatmap is available to Strava registered users only. When you click to https://www.strava.com/heatmap and login to Strava, your browser gets several cookies that it includes in later requests to be granted permission to download the hi-res tiles of the Strava Heatmap.
The authentication process consist of three steps:
- The sser fills the login form at https://strava.com/login.
- Upon submit, the browser sends a POST request to https://www.strava.com/session,
email=<STRAVA_EMAIL>, password=<STRAVA_PASSWORD>, remember-me checkbox set,
and in exchange it receives
_strava4_session
,strava_remember_id
, andstrava_remember_token
cookies from the server. - The browser sends a GET request to https://heatmap-external-a.strava.com/auth
with the session cookies set, and gets
CloudFront-Signature
,CloudFront-Policy
, andCloudFront-Key-Pair-Id
cookies from server.
The last three cookies are those needed to allow the browser to download the high-res heatmap tiles. Concatenating the cookie strings to the TMS URLs (as shown below) allows external applications (such as JOSM or Cartograph Maps) to download the hi-res tiles from Strava.
Example of a TMS URL that can be used in JOSM to get the hi-res version of the Strava Heatmap:
tms[3,15]:https://heatmap-external-{switch:a,b,c}.strava.com/tiles-auth/run/hot/{zoom}/{x}/{y}.png?Key-Pair-Id=<YOUR_KEY_PAIR_ID_COOKIE_VALUE>&Policy=<YOUR_POLICY_COOKIE_VALUE>&Signature=<YOUR_SIGNATURE_COOKIE_VALUE>
Cookies expire, so it is necessary to re-login to Strava from time to time to get up to date cookies.
Licence
stravacookies
is distributed under the GPL v3.0 licence.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for stravacookies-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86cf099ff8573b6b2502a4f7d4efd65ab5a28d501c70ac8924428937e08ef1ea |
|
MD5 | e45fa752200fb52ded3865da3031ba88 |
|
BLAKE2b-256 | a7374f77f8b8dde2037b2bc6e07b00f649164bc8e696c93325a3807251d3fb1d |