Skip to content

Instantly share code, notes, and snippets.

@rantoniuk
Created July 1, 2020 16:18
Show Gist options
  • Save rantoniuk/0a8deb9f6524b61c57c40e2ecf0e430b to your computer and use it in GitHub Desktop.
Save rantoniuk/0a8deb9f6524b61c57c40e2ecf0e430b to your computer and use it in GitHub Desktop.
Export Endomondo gpx for Strava
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');
}
});
})();
{
"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