Beginner attempting to download TCX file

237 views
Skip to first unread message

Max Thompson

unread,
Oct 26, 2017, 9:52:56 PM10/26/17
to Strava API
I'm currently just trying to download TCX files from my activities - done by appending "/export_tcx" to the end of the activity URL. I don't know if the API is useful in helping with this, but it seemed like the best place to ask this question. I floundered my way through a bunch of cURL commands, but I've yet to get anything to work.

My current command looks like this:

curl -L --user underasail https://www.strava.com/activities/1248362100/export_tcx.tcx -o './testing.tcx'

This returns an HTML file with the first three lines:

<!DOCTYPE html>
<html class='logged-out fullscreen responsive swimming-background-1 s-minifeed old-login' dir='ltr' lang='en-US' xmlns:fb='http://www.facebook.com/2008/fbml' xmlns:og='http://opengraphprotocol.org/schema/' xmlns='http://www.w3.org/TR/html5'>


I have a lot of activities logged in Strava, and I'm simply trying to find a way to speed up exporting the TCX files as Strava doesn't currently have a way to do that in bulk like the GPX files. Any help would be greatly appreciated, and I understand if this isn't the proper place to post this.

rao loka

unread,
Oct 27, 2017, 7:17:50 PM10/27/17
to Strava API
I think it is just export_tcx (the .tcx probably shouldn't be there.
I believe what you're seeing is the response to login to Strava. Further down, you may see a response that specifies the activity is there (or found), but I couldn't find the tcx  data itself. I recall coming across a few places that mentioned the export_tcx interface has changed (and as far as I can tell, it probably works with web apps only).

Max Thompson

unread,
Oct 27, 2017, 8:03:44 PM10/27/17
to Strava API
Ah, I'm guessing somewhere in my shuffling around the extra .tcx made its way into there.
Can you think of any other way I might be able to automate the process?

Carey

unread,
Nov 15, 2017, 7:30:11 AM11/15/17
to Strava API
You're not going to be able to just use a simple cURL command to do that. Strava requires you to be logged into your account to download the activities and cURL can only do HTTP basic auth.

Basic how-to:
 - Use cURL to GET the /login page and parse out the CSRF information
 - POST your login details + CSRF info to /session and store the cookies the server sets.
 - Tell cURL to use those cookies when making the request to https://www.strava.com/activities/<activity_id>/export_tcx

I had the same issue as you so I built a Python library to do it for me, you're welcome to use it: https://github.com/pR0Ps/stravaweblib
Reply all
Reply to author
Forward
0 new messages