Created
August 29, 2016 13:34
-
-
Save leonhandreke/98041d9f3b2bdbd65d471213133d2758 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
set -x | |
# your Strava login details go here | |
EMAIL=leonh@ndreke.de | |
PASSWORD=your_secret_password | |
FILE=$1 | |
CURL="curl --cookie /tmp/strava-cookies.txt --cookie-jar /tmp/strava-cookies.txt" | |
# get login page | |
AUTH=$($CURL -k https://www.strava.com/login | grep 'name="authenticity_token"' | sed 's/.*value="\(.*\)".*/\1/g') | |
echo "AUTH=$AUTH" | |
# login | |
$CURL -k --data-urlencode "utf8=✓" --data-urlencode "authenticity_token=$AUTH" --data-urlencode "plan=" --data-urlencode email="${EMAIL}" --data-urlencode password="${PASSWORD}" --data-urlencode "remember_me=on" https://www.strava.com/session | |
# go to upload page | |
$CURL http://www.strava.com/upload/select | grep "authenticity_token" | |
# send file | |
$CURL -F "_method=post" -F "authenticity_token=$AUTH" -F "files[]=@$FILE" http://www.strava.com/upload/files | |
# logout | |
$CURL --data-urlencode "_method=delete" --data-urlencode "authenticity_token=$AUTH" http://www.strava.com/session | |
rm /tmp/strava-cookies.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment