Skip to content

Instantly share code, notes, and snippets.

@scottpdawson

scottpdawson/strava.js

Last active Oct 15, 2020
Embed
What would you like to do?
Bulk download Strava activities
var maxPage = 25; // calculate this using (activities/20 + 1)
var activityType = "Run"; // change to the workout type you want, or blank for all
var p = 1;
var done = 0;
var url;
var nw = window.open("workouts.html");
nw.document.write("[");
while (p <= maxPage) {
url = "https://www.strava.com/athlete/training_activities" +
"?keywords=&activity_type=" + activityType + "&workout_type=&commute=&private_activities=" +
"&trainer=&gear=&new_activity_only=false" +
"&page=" + p + "&per_page=20";
jQuery.ajax({
url: url,
dataType: "json",
method: "GET",
success: function(data, textStatus, jqXHR) {
for (i in data.models) {
nw.document.write(JSON.stringify(data.models[i]) + "," + "");
}
done++;
if (done >= maxPage) {
nw.document.write("]");
nw.document.close();
}
window.open("workouts.html");
}
});
p++;
};
window.open("workouts.html");
@scottpdawson

This comment has been minimized.

Copy link
Owner Author

@scottpdawson scottpdawson commented Oct 15, 2020

See blog post for detailed usage instructions. Steps:

  1. Go to https://www.strava.com/athlete/training after signing in.
  2. Open Chrome’s developer tools and navigate to console window.
  3. Set maxPage and activityType above.
  4. Paste code into console.
  5. Copy new window's content into https://konklone.io/json to convert to CSV.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.