Skip to content

Instantly share code, notes, and snippets.

@scottpdawson
Last active May 21, 2025 19:19

Revisions

  1. scottpdawson revised this gist Oct 15, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions strava.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    var maxpage = 25; // calculate this using (activities/20 + 1)
    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) {
    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" +
    @@ -19,7 +19,7 @@ while (p <= maxpage) {
    nw.document.write(JSON.stringify(data.models[i]) + "," + "");
    }
    done++;
    if (done >= maxpage) {
    if (done >= maxPage) {
    nw.document.write("]");
    nw.document.close();
    }
  2. scottpdawson created this gist Oct 15, 2020.
    31 changes: 31 additions & 0 deletions strava.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    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");