Git Product home page Git Product logo

nrctostrava's Introduction

NRCToStrava

Script to export/convert/upload run activities from Nike Run Club to Strava

Requirements

  • Python 3: All requirements are set in requirements.txt

  • Command-line JSON processor: download and install jq (version >= 1.6)

  • Strava:

    • In order to upload NRC running data to Strava, it is required to make an application as explained here and fulfill all necessary fields.

Prerequisites

NikeRunClub

All Nike+ API is explained in Yoshimasa Niwa's gist. Fetching NRC activities requires a bearer token from their website:

  • Go to Nike Membership page and login
  • Open the developer tools in your browser and filter all "api.nike.com" requests
  • You should be able to find such request: "/engage/invites/v1...", then click on it
  • In Request Headers there should be an Authorization header with a Bearer value
  • Copy this value somewhere, it will be asked during NRCToStrava.bash execution

Strava

Uploading a run to Strava requires your Client ID, Client Secret and an access token with write permission:

Run bash script

Run script:

$ sh NRCToStrava.bash <bearer_token>

Paste NRC bearer value and press enter.

Compatibility

This script has been tested on runs from 2014 to 2019.

Notes

You can "Edit distance" on your run in Strava if the difference between NRC and Strava data is too big.

Credits

  • NRCToStrava.bash is adapted from Yoshimasa Niwa's gist in order to convert JSON data to TCX and upload to Strava
  • stravaupload.py is adapted from Eirik Marthinsen github in order to work with Python 3 and current Strava API

nrctostrava's People

Contributors

opierre avatar

Stargazers

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

Watchers

 avatar

nrctostrava's Issues

Directory parsing is not working well

I spent a few hours today trying to you use your tool (It is great btw!).

I faced a couple of issues with regards to packages and I had to install a couple of packages manually before retrying to run the script again (pytz being the biggest pain in the neck), so you might want to consider using a requirements file in the next version.

Another issue I faced was the directory parsing and file names; in your scripts you're prefixing the directories with \\ which doesn't seem to work. On multiple occasions, I had the tcx files converted and ready for upload, only for the uploader not to find any of them in TCX_exports. After inspections, I found out that the script had converted them pretty well, but wasn't able to export or upload them to Strava because the directory was empty. I had to tweak the code (and hard-code the directory in there) in order to get it to work.

Additionally, after I finally got them exported as tcx files there, the uploader was not able to find any of them in the directory and failed. After removing the prefix of \\ and hard-coding the right directory, it worked flawlessly.

Finally, thank you so much for creating such a great tool for migrating from NRC to Strava :)!

ValueError: astimezone() cannot be applied to a naive datetime

Hello,
I'm getting this error when running the script:

Fetching https://api.nike.com/sport/v3/me/activity/92c114e0-fd9f-40ed-aff5-6b5f4422cfaf?metrics=ALL... % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed '100 268k 0 268k 0 0 436k 0 --:--:-- --:--:-- --:--:-- 436k
Converting activity-92c114e0-fd9f-40ed-aff5-6b5f4422cfaf.json... Traceback (most recent call last):
File "./scripts/nrcToTcx.py", line 90, in <module> convert(sys.argv[1])
File "./scripts/nrcToTcx.py", line 80, in convert tcx = Generator(activityData)
File "./scripts/nrcToTcx.py", line 29, in __init__ self.activity = Activity(self.activities, self.data['start_epoch_ms']).activity
File "/nfs/scripts/lib/NRCToStrava/scripts/tcx_format/Activity.py", line 15, in __init__ self.id.text = epochToReadable(ident)
File "/nfs/scripts/lib/NRCToStrava/scripts/utils/functions.py", line 12, in epochToReadable finalTime = finalTimeWithLocalUtc.astimezone(utc)
` ValueError: astimezone() cannot be applied to a naive datetime

Thanks!

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.