Last active
April 20, 2018 20:47
-
-
Save benfoxall/be1b1827978a64b7b40d to your computer and use it in GitHub Desktop.
A bash script for exporting runkeeper data.
This file contains hidden or 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
# Requires: | |
# a) `jq` to be installed | |
# b) A Bearer token (you can grab this from the healthgraph debug console) | |
export BEARER=MY_TOKEN_FROM_THE_CONSOLE | |
curl https://api.runkeeper.com/fitnessActivities?pageSize=100 -H "Authorization: Bearer $BEARER" > page1.json | |
curl https://api.runkeeper.com/fitnessActivities?pageSize=100&page=2 -H "Authorization: Bearer $BEARER" > page2.json | |
curl https://api.runkeeper.com/fitnessActivities?pageSize=100&page=3 -H "Authorization: Bearer $BEARER" > page3.json | |
curl https://api.runkeeper.com/fitnessActivities?pageSize=100&page=4 -H "Authorization: Bearer $BEARER" > page4.json | |
curl https://api.runkeeper.com/fitnessActivities?pageSize=100&page=5 -H "Authorization: Bearer $BEARER" > page5.json | |
# add more if you have more pages of data | |
# Find all activity urls | |
jq '.items' page*.json | grep uri | sed 's/^.*"\///g' | sed 's/"//g' > urls.txt | |
# Download json data | |
mkdir fitnessActivities | |
while read p; do | |
curl https://api.runkeeper.com/$p -H "Authorization: Bearer $BEARER" > $p.json | |
done < urls.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment