Last active
October 3, 2022 06:32
-
-
Save stampyzfanz/251fd2de2399867c7de4f7d1e6b61850 to your computer and use it in GitHub Desktop.
Exports Mapmyrun workouts to a series of tcx files which can be imported into lots of software.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # Javascript to copy in dev tools console | |
let data = await (await fetch("https://www.mapmyrun.com/internal/allWorkouts/?started_after=2020-01-29")).json() | |
// Change started_after for date you want to filter from or remove entirely for every workout | |
// Api parameters: | |
// number user= *id* - can be found in url of the person's profile ie https://www.mapmyrun.com/profile/[id]/activity_feed | |
// ISO-8601-date started_after= *date* for example this is valid 2020-01-29 | |
// ISO-8601-date started_before= *date* this is another valid date 2011-10-05T14:48:00.000Z | |
// Remove ?user= to access only your own workouts | |
// Example url using all 3 parameters | |
// https://www.mapmyrun.com/internal/allWorkouts/?started_after=2020-01-29&started_before=2021-5-29&user=123456789 | |
// To filter workouts by type | |
data = data.filter(x => x.name.includes('Road Cycling')) | |
// You can edit the line above, or remove it entirely if you want to keep every workout | |
let workoutUrls = JSON.stringify(data).match(/\/workout\/(\d*)\//g) | |
// At this point I reccomend the following steps | |
// 1 Tell your web browser to ask where the file should be saved | |
// 2 Create a folder for the files and save a single file | |
// 3 Tell web browser to automatically download files | |
// 4 After the sea of tabs open and close, reset web browser download preference setting to previous | |
for (let link of workoutUrls) { | |
window.open(link.replace('/workout', '/workout/export') + 'tcx') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment