Giter VIP home page Giter VIP logo

strava-backup's Introduction

Strava-Backup

Get your data back from Strava.

Strava has an export options, but it will only give you the GPX files that Strava produces after analyzing your uploads.

Thankfully, there is a hidden option to download the original file for individual activities. However, this is only available on the website and not via the API.

This tool uses the API to get a list of all your events, then web scraping to log into the site using your username and password and download the original files for all your activities.

The "original file" will usually be either a *.fit file (most Garmin devices), *.tcx, *.gpx, or *.json (Strava mobile application).

The tool will also output a *.meta.json file for every activity that includes more information on the activity (name, description, type, distance, equipment, etc).

Additionally, the tool will backup your shoes and bikes information, as well as any photos that have been added to activities.

Authentication

Accessing the Strava API requires a short-term access token. In order access your account on an ongoing basis, strava-backup requires a long-term "refresh token" and some other information with which it can generate access tokens. For more information see the Strava API authentication documentation.

A "refresh token" can be generated using a separate program such as strava-tokengen.

In order to back up your data, strava-backup can use the following scopes (all optional):

  • profile:read_all ("View your complete Strava profile"): Will read and backup gear data
  • activity:read ("View data about your activities"): Will read and backup activity data
  • activity:read_all ("View data about your private activities"): Will read and backup private activity data

Setup

Use pip to install this package:

pip install strava-backup

By default, strava-backup will look for a config file called strava-backup.conf in $XDG_CONFIG_HOME/, falling back to ~/.config/ if it's unset. An alternate file can be specified using the --config option.

A sample config file has been included in this package. Copy it to the correct spot and fill in the required information.

Running

strava-backup is an incremental backup. It tracks what has already been downloaded by looking at the output directory and doesn't download it again.

To download all new data, simply run strava-backup. See strava-backup --help for other options. To backup data on an ongoing basis, configure your system to call strava-backup periodically (see the /contrib folder for examples).

strava-backup's People

Contributors

pr0ps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

strava-backup's Issues

List of activities cannot be downloaded

stravalib version 0.10.3 fixes a change in the Strava API that leads to an IndexError when getting a list of activities. Currently, the setup specifies version 0.10.2 as the minimum.

Add incremental option

Would stop downloading activities once it hits an activity that has already been downloaded. This would avoid wasting API calls listing through all old activities at the expense of missing activities that were uploaded out of order.

Add min age option

Would allow for only downloading activities that were uploaded some time ago. This would be good in cases where activities are automatically uploaded and you want some time to be able to tweak them on the website (rename, change equipment, etc) before they're downloaded by the script.

Requirements issue

There seems to be a missing = sign on line 18 of setup.py. The current requirement for the stravalib library is written as >0.10.2, since the library is still at v0.10.2 the requirement is not satisfied and the pip install command does not work. I think the line should be:

install_requires=["stravaweblib>=0.0.4,<1.0.0", "stravalib>=0.10.2,<1.0.0"],

Automatic handling of refresh vs access tokens

Thanks for this great tool and also for strava-tokengen! One difficulty I found is that tokengen gives me a refresh token, while backup wants an access token. Currently I work this around in a bash script, see https://github.com/vmiklos/vmexam/blob/master/strava/backup. But it would be much better, if backup would accept a refresh token, and it would manage the creation (and if necessary, update) of the the access token.

I'm fine with looking into this myself, in case the feature (in theory) would be accepted in the form or a PR. What's your opinion about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.