Created
July 1, 2020 16:18
-
-
Save rantoniuk/0a8deb9f6524b61c57c40e2ecf0e430b to your computer and use it in GitHub Desktop.
Export Endomondo gpx for Strava
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
require('cross-fetch/polyfill'); | |
const fs = require('fs'); | |
const { Api } = require('endomondo-api-handler'); | |
const { DateTime } = require('luxon'); | |
const api = new Api(); | |
(async () => { | |
await api.login(LOGIN, PASSWORD); | |
await api.processWorkouts({ | |
after: DateTime.fromISO('2020-01-01T00:00:00.000'), | |
before: DateTime.fromISO('2020-07-01T23:59:59.999'), | |
} | |
, async (workout) => { | |
console.log(workout.toString()); | |
if (workout.hasGPSData()) { | |
fs.writeFileSync(`tmp/${workout.getId()}.gpx`, await api.getWorkoutGpx(workout.getId()), 'utf8'); | |
} | |
}); | |
})(); |
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
{ | |
"name": "endomondo-strava", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": {}, | |
"author": "", | |
"license": "MIT", | |
"dependencies": { | |
"cross-fetch": "^3.0.5", | |
"endomondo-api-handler": "^6.19.0", | |
"luxon": "^1.24.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment