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.

Revisions

  1. @warden warden created this gist Jul 1, 2020.
    21 changes: 21 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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');
    }
    });
    })();
    14 changes: 14 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    {
    "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"
    }
    }