Skip to content

Instantly share code, notes, and snippets.

@axelav
Created January 6, 2022 16:39
Show Gist options
  • Save axelav/95ae774e0ae175156a53d2fed56dbe58 to your computer and use it in GitHub Desktop.
Save axelav/95ae774e0ae175156a53d2fed56dbe58 to your computer and use it in GitHub Desktop.
Download
// https://www.strava.com/athlete/training
// json -> csv https://konklone.io/json/
const MAX_PAGE = 50; // calculate this using (activities/20 + 1)
const ACTIVITY_TYPE = "Workout"; // change to the workout type you want, or blank for all
/* const url = "https://www.strava.com/athlete/training_activities" + */
/* "?keywords=&activity_type=" + ACTIVITY_TYPE + "&workout_type=&commute=&private_activities=" + */
/* "&trainer=&gear=&new_activity_only=false" + */
/* "&page=" + p + "&per_page=20"; */
let p = 1;
let done = 0;
let activities = []
while (p <= MAX_PAGE) {
const url = `https://www.strava.com/athlete/training_activities?keywords=&activity_type=${ACTIVITY_TYPE}&workout_type=&commute=&private_activities=&trainer=&gear=&new_activity_only=false&page=${p}&per_page=20`
jQuery.ajax({
url,
dataType: "json",
method: "GET",
success: function(data, textStatus, jqXHR) {
activities = [...activities, ...data.models]
done++;
}
});
p++;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment