Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download all activities from Runtastic.com (as .gpx)

Download all activities from Runtastic 🏃

With this script you can download all your activities from www.runtastic.com in .gpx format. Runtastic removed this feature wich makes it very difficult to change your tracking service, thanks for that.

❗️ Only tested in Google Chrome 41.0+

How does it work

Login to your runtastic account and go to the page where all your activities are listed. Then open the developer tools of Chrome with CMD + OPTION + I and go to the console tab. Now copy and paste the following script in the console line and press enter. The usually content should disapear and the downloads should start. I used it to export around 290 activities and it worked fine.

$('body').html('');
$.each(index_data,function(i, value)
{
    var id = value[0],
        url = 'https://' + app_config.domain+user.run_sessions_path+value[0] + '.gpx',
        filename = 'RUNTASTIC-' + value[1] + '-' + value[0] + '.gpx';

    $.ajax({
        url: 'https://' + app_config.domain + user.run_sessions_path + id + '.gpx',
        success: function(data, textStatus, jqXHR)
        {
            if(textStatus == 'success')
            {
                $('<a/>', {
                    'href' : 'data:text/plain;charset=utf-8,' + encodeURIComponent(jqXHR.responseText),
                    'download' : filename,
                    'id' : id
                }).html(filename)
                .before(i + '. Downloaded: ')
                .after('<br/>')
                .prependTo('body');

                $('#' + id)[0].click();
            }
            else
            {
                console.log(textStatus);
            }
        },
        dataType: 'xml',
        beforeSend: function(xhr){
            xhr.setRequestHeader('X-Requested-With', ' ');
        },
    });
});
@maxheadroom

This comment has been minimized.

maxheadroom commented Feb 17, 2016

works like charm . Thank you for sharing!

@antjamesbird

This comment has been minimized.

antjamesbird commented Feb 20, 2016

Great script, thanks!
Just moved all Runtastic data to strava.

@bcambel

This comment has been minimized.

bcambel commented Mar 2, 2016

👍 life saver man! All data in Strava now!

@sougat818

This comment has been minimized.

sougat818 commented Mar 9, 2016

A Million Thanks to you!

@hranicka

This comment has been minimized.

hranicka commented Mar 20, 2016

Thank you a lot!

I've created a modified version which saves all data into one ZIP file.

With respect.

@christianewald

This comment has been minimized.

Owner

christianewald commented Apr 19, 2016

I added a fix for the "401 Unauthorized" bug. I received it by a really nice guy who send me this fix. I actually don't maintain this script anymore because my activities are now already in Strava since I exported them once and I don't use Runtastic anymore because of their lack of support for usual running devices.

Here is the mail of our pleasant, helping friend (can't find him on Github):

Unfortunetaly it was not working in published version - after recent updates to runtastic page, the ajax request returns error 401 (Unauthorized). I've made some research and it turned out, they've added request headers check to prevent such mass download, but not very clever one :)

To make your script working again, you need to update request header by adding 'beforeSend' parameter to ajax call:

   beforeSend: function(xhr){
     xhr.setRequestHeader('X-Requested-With', ' ');
   },

(default value for request via ajax is XMLHttpRequest and above lines will clear it)

@PattaFeuFeu

This comment has been minimized.

PattaFeuFeu commented Apr 22, 2016

Worked fine with Chrome 49 on OSX. Thank you!

@23tux

This comment has been minimized.

23tux commented May 17, 2016

Tested with Chrome Version 50.0.2661.94 (64-bit) on OSX.
Chrome asked me if I allow to download multiple files at once, then it worked like a charm!

Thanks!

@oristelle

This comment has been minimized.

oristelle commented May 19, 2016

YOU ARE A GENIUS, many thanks

@luisfgfurtado

This comment has been minimized.

luisfgfurtado commented Jun 6, 2016

Works like charm. Thank you!

@jonasbits

This comment has been minimized.

jonasbits commented Jun 12, 2016

Works with Chrome 51.0.2704.84 on Win10

@joshre

This comment has been minimized.

joshre commented Jul 13, 2016

Marvelous, thanks!

@senden9

This comment has been minimized.

senden9 commented Aug 21, 2016

Thanks. Works also with Firefox 48

@davidbalazs

This comment has been minimized.

davidbalazs commented Sep 23, 2016

thank you, it helped me a lot!

@Dexter0912

This comment has been minimized.

Dexter0912 commented Sep 29, 2016

I can't download it!! Could You help me?
przechwytywanie1

przechwytywanie

@cdragicevic

This comment has been minimized.

cdragicevic commented Sep 29, 2016

Just arrived 6 hours later than the previous comment, and the same problem/errors on Chrome 49.0.2623.112 (64-bit) and OSX 10.6.8.

Maybe a problem in runtastic.com? I cant download the traditional way either, because chrome goes to the download link ending in ".gpx" and showing blank content instead of downloading it.

@Dexter0912

This comment has been minimized.

Dexter0912 commented Sep 30, 2016

Got the same problem...

@luemmel

This comment has been minimized.

luemmel commented Oct 2, 2016

The script doesn´t work for me too (Chrome 53 OSX, FF 49 OSX): I have 300 activities: when i run the script, 2 to 4 activities can be downloaded, all other activities will fail (i debugged the script a little bit). When i try to download the activities manually, it works. IMO there is a kind of "the user is allowed to download x activities in x seconds" rule or so.

@luemmel

This comment has been minimized.

luemmel commented Oct 3, 2016

I did some more investigations: There is an option on runtastic.com to download the .gpx for a single activity. If you try to download the .gpx file, often an http error occurs. If you retry, sometimes the download is successful. For me, this simple change fixed the script:

error : function(xhr, textStatus, errorThrown ) {
      $.ajax(this);
    },
@rbredow

This comment has been minimized.

rbredow commented Oct 16, 2016

Adding @luemmel's "retry on error" code was required for me today too. For those who aren't sure where that code belongs, here is the script with the added code that worked for me:

Takes a while if you have a hundred runs to export, but you only have to do it once!

$('body').html('');
$.each(index_data,function(i, value)
{
    var id = value[0],
        url = 'https://' + app_config.domain+user.run_sessions_path+value[0] + '.gpx',
        filename = 'RUNTASTIC-' + value[1] + '-' + value[0] + '.gpx';

    $.ajax({
        url: 'https://' + app_config.domain + user.run_sessions_path + id + '.gpx',
        success: function(data, textStatus, jqXHR)
        {
            if(textStatus == 'success')
            {
                $('<a/>', {
                    'href' : 'data:text/plain;charset=utf-8,' + encodeURIComponent(jqXHR.responseText),
                    'download' : filename,
                    'id' : id
                }).html(filename)
                .before(i + '. Downloaded: ')
                .after('<br/>')
                .prependTo('body');

                $('#' + id)[0].click();
            }
            else
            {
                console.log(textStatus);
            }
        },
        error : function(xhr, textStatus, errorThrown ) {
            $.ajax(this);
        },
        dataType: 'xml',
        beforeSend: function(xhr){
            xhr.setRequestHeader('X-Requested-With', ' ');
        },
    });
});
@Jagounet

This comment has been minimized.

Jagounet commented Nov 2, 2016

Thx its ok with firefox today 👍

@GOTAY

This comment has been minimized.

GOTAY commented Nov 8, 2016

I'm getting a 403 (Forbidden) errors...
Any help will be appreciated.
Using Chrome 54.0.2840.71 (resently updated)

@GOTAY

This comment has been minimized.

GOTAY commented Nov 8, 2016

With Firefox I can see an access denied... Just 5 activities downloaded fine...

@laszlojohl

This comment has been minimized.

laszlojohl commented Nov 14, 2016

I'm also getting a 403 Error on Chrome Version 55.0.2883.44. Which basically means, the server denied my request. Is there a solution to circumvent the server rule?

@cheb92

This comment has been minimized.

cheb92 commented Nov 15, 2016

Hi

It didn't work today for me on chrome 54.0.2840.99 and on firefox 49.0.2. Any way to workaround this problem ?

Regards

@shodyesq

This comment has been minimized.

shodyesq commented Nov 16, 2016

I'm also getting the "403 (Forbidden)" error. Any solutions discovered?

@Metalnem

This comment has been minimized.

Metalnem commented Nov 28, 2016

Runtastic recently introduced rate limiting for export requests. I wrote a little command line tool that uses Runtastic API directly to manually export every activity that has a GPS trace available. You can download it here. If you want to know more, read the two posts on the subject at my blog.

@jcarias

This comment has been minimized.

jcarias commented Jan 25, 2017

@Metalnem Thank's it worked like a charm!

@jozelito

This comment has been minimized.

jozelito commented Jan 31, 2017

@Metalnem, the cmd line tool works perfectly.
Thanks a lot,!!

@ScoutVik

This comment has been minimized.

ScoutVik commented Mar 6, 2017

I can save all my ACTIVITIES in Runtastic.
Is it still working or not any more?
I have a lot of activities with and without GPS too..
Thanks.

@djforsberg

This comment has been minimized.

djforsberg commented Apr 13, 2017

@Metalnem, thanks for putting together...trying to get it to work, but not getting anything...probably user error....is there a script that works? or do I need to do anything when I open your prog? thanks!

@DiWa51

This comment has been minimized.

DiWa51 commented Apr 24, 2017

Unfortunately none of this scripts worked for me (even in forked / revised versions).

Though Thanks a lot @Metalnem.
I just downloaded your binary launch it with the 3 command line arguments and got my results few seconds later (~30s for ~80 activities). @djforsberg did you wait long enough?

@leomiquelutti

This comment has been minimized.

leomiquelutti commented May 9, 2017

@Metalnem it worked fine for me. Thank you very much.

@ERueland

This comment has been minimized.

ERueland commented May 16, 2017

@Metalnem - great work!
Just finished and everything is fine.
Maybe as an explanation for the rookies: download runtastic.exe (respective .exe windows/MaxOS/Linux) below "Downloads" and start the process with your e-mail, password & file version in the command line.
It takes some minutes (for some hundred excercises) and suddenly there is the .zip file with all your runtastic data!!! THANX!

@fetteotter

This comment has been minimized.

fetteotter commented May 18, 2017

@Metalnem ... THANK YOUUUUU SO MUCH => for the ones who are not IT 🗡 ... download the file as @ERueland wrote ... then go to console Win2010(Win+x => powershell admin) ... then enter ".\runtastic -email xyz@xyvzde -password xyz -format tcx" in this console ... needs some time, than an archive file will appear!

@viragored

This comment has been minimized.

viragored commented May 19, 2017

@Metalnem - thanks so much for the code. I'm pretty much a rookie at this stuff so it took me a while to finally make it work. @fetteotter gave a good helping description, but I needed one more step before anything happened. The downloaded file went into my default download folder, and from there I copied it to C:\Windows\System32 Then the command line executed properly.
I have Windows 10 64-bit so was able to access the admin level command prompt by right click on the home (Windows) button.
And now my activities are in Strava - which is limiting uploads to 25 at a time.
Thanks once more :-)

And in case it helps any more rookies like me, here are the steps I carried out (with copy/paste from posts above, as appropriate)

  • Download Windows zip file from github (below the word "Downloads")
  • Unzip the downloaded file
  • Copy or paste the file runtastic.exe to C:\Windows\System32 - give administrator permission when prompted
  • Right click the Windows home button and choose "Command Prompt (Admin)"
  • In the command prompt window that opens type your version of:
  •  runtastic -email xyz@xyvzde -password xyz -format tcx
    
  • [Wait for the command prompt to return - the time will vary with the number of activities to download]
  • Close the command prompt window
  • Move the downloaded "Runtastic - date" zip file that will be in C:\Windows\System32 to a suitable working space
  • Delete runtastic.exe from C:\Windows\System32
  • Unzip the downloaded "Runtastic - date" zip file
  • Then use your target application to upload the activities
@KFubuki

This comment has been minimized.

KFubuki commented May 19, 2017

Thank you man!

@mmckaibab

This comment has been minimized.

mmckaibab commented May 22, 2017

Not working. No matter what I do it keeps coming back saying email or password is invalid. I log into Runtastic using my Google+ account.

@aaamccaffrey

This comment has been minimized.

aaamccaffrey commented Jun 21, 2017

I had a similar issue since I logged into Runtastic using Facebook. The way around this is to log out of Facebook (Google+ in your case), browse to Runtastic.com, click the Forgotten Password link, now enter your email address. Once an email comes in from Runtastic you can now set a standard password. Worked for me!

@pdabholkar

This comment has been minimized.

pdabholkar commented Jul 8, 2017

The command line tool works like a charm. Thank you.

@AntonioO68

This comment has been minimized.

AntonioO68 commented Jul 8, 2017

Great work! More than 650 activities downloaded...
If I may suggest, Strava has a 25 files per upload, so if possible and someone wants to spend some time on it, a 25 files folder creator would we super awesome.

Again txs!

@WYNXFIST

This comment has been minimized.

WYNXFIST commented Jul 12, 2017

Thanks for the script, but I only get the first 5 of several hundred of my activities. What am I doing wrong? I'm using Google Chrom Version 59.0.3071.115 (Official Build) (64-bit)
Thank you in advance.

@caudan

This comment has been minimized.

caudan commented Jul 20, 2017

@viragored Thanks, this is work it. Other code not function.

@paulo59

This comment has been minimized.

paulo59 commented Aug 1, 2017

I have the same issue as WYNXFIST: I can get only the first five files.
I got 403 Forbidden reply for all others.
Thanks in advance for your help.

@Robyer

This comment has been minimized.

Robyer commented Aug 3, 2017

Scripts get only first 5 activities because Runtastic added captcha protection, so after every 5 downloads you must pass the captcha.
There is check that says whether or not you are able to download another file: https://www.runtastic.com/check_export_quota which gives response {"export_allowed":true} or {"export_allowed":false} respectively.

Metalnem's solution use different approach so that should work. See his comment: https://gist.github.com/christianewald/0009d3ce1a372a11ae82#gistcomment-1932702

@mihalltss

This comment has been minimized.

mihalltss commented Aug 9, 2017

guys that guide from @Metalnem is good just only write your login accout and password to runtastic for example runtastic -email youremail@gmail.com -password yourpassword -format tcx

and everything will be downaloaded

@Happyfeet01

This comment has been minimized.

Happyfeet01 commented Sep 16, 2017

i have also an Access Forbidden Problem.

@ozkar121

This comment has been minimized.

ozkar121 commented Nov 23, 2017

I just made a tutorial, on how to do it!
https://www.youtube.com/watch?v=sCrBWePqoJ0

@datacon2018

This comment has been minimized.

datacon2018 commented Feb 27, 2018

Because the solution from @Metalnem is currently not working, at least for me. I modified the script lightly, it just waits 6 hours if the download fails, hence it took very long but at least it gets the job done at the moment until the runtastic guys find a way to prevent even this.
The first setTimeout is not needed anymore.

$('body').html('');

$.each(index_data, function(i, value) {
var seconds=5*60,
    format='.tcx'; // '.gpx'

setTimeout(

function fexport () {
    var id = value[0],
        url = 'https://' + app_config.domain+user.run_sessions_path+value[0] + format,
        filename = 'RUNTASTIC-' + value[1] + '-' + value[0] + format;

    $.ajax({
        url: 'https://' + app_config.domain + user.run_sessions_path + id + format,

        success: function(data, textStatus, jqXHR) {
            if(textStatus == 'success') {
                $('<a/>', {
                    'href' : 'data:text/plain;charset=utf-8,' + encodeURIComponent(jqXHR.responseText),
                    'download' : filename,
                    'id' : id
                }).html(filename)
                .before(i + '. Downloaded: ')
                .after('<br/>')
                .prependTo('body');

                $('#' + id)[0].click();
            }
            else {
                console.log(textStatus);
            }
        },

        error: function(jqXHR, textStatus, errorT) {
                $('<a/>', {
                    'href' : 'data:text/plain;charset=utf-8,' + encodeURIComponent(jqXHR.responseText),
                    'download' : filename,
                    'id' : id
                }).html(filename)
                .before(i + '. failed: ')
                .after(' ERR: ' + jqXHR.responseText + '.<br/>')
                .prependTo('body');

                // try again in 6 hours...and again...and again...
                setTimeout(fexport, 6*60*60*1000);
        },

        dataType: 'xml',

        beforeSend: function(xhr){
            xhr.setRequestHeader('X-Requested-With', ' ');
        },
    });


}, i*seconds*1000); 


});
@djmandix

This comment has been minimized.

djmandix commented Mar 7, 2018

The latest version from datacon2018 (above) doesn't work for me. Neither on Chrome (64.0.3282.186), nor on Firefox (58.0.2). I receive the following error message. Any suggestions? Vendor lock sucks so much!

Error message:
0. failed: RUNTASTIC-2011-04-05-1904281.tcx ERR: access denied.

@nokodemus

This comment has been minimized.

nokodemus commented Mar 17, 2018

I think ReCaptcha is causing this issue ... it's activated on ... i think every fifth activity export ...
So as soon as you get ERR:access denied, you'll have to manually download an activity an solve ReCaptcha ...

After solving another about 5 scripted exports will work

I don't have a clue how to bypass this ... you'd have to trick Google's ReCaptcha ...

@sneakpodbob

This comment has been minimized.

sneakpodbob commented May 15, 2018

I get segfaults with the runtastic-Downloader.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x61faa0]

goroutine 1 [running]:
github.com/metalnem/runtastic/api.(*Session).GetActivities(0xc420450040, 0x7e2bc0, 0xc42009a008, 0x15, 0x7fff01ebee02, 0xd, 0xc420450040, 0x0)
/Users/Metalnem/Go/src/github.com/metalnem/runtastic/api/api.go:660 +0x160
main.main()
/Users/Metalnem/Go/src/github.com/metalnem/runtastic/main.go:142 +0x1bc

I have lot's of manually entered activities in my account (they got no gps-data, only duratio, length and some avg. values) - could they be the problem?

@smileyint

This comment has been minimized.

smileyint commented Aug 23, 2018

Anyone please advice for @Metalnem exe file, i using facebook login for the credentials but is not working.

@mauricio-trigueros

This comment has been minimized.

mauricio-trigueros commented Sep 6, 2018

Hi! I have similar issues with my Runtastic account. I end up creating a similar project here to download the activities, based on @christianewald idea.
The main difference is that you download first a list with all the activities to download, and then you use a Python script to download all one by one (so you need to run the script several times because every time only downloads 5 files).

@welzepit

This comment has been minimized.

welzepit commented Oct 19, 2018

Hi! I have similar issues with my Runtastic account. I end up creating a similar project here to download the activities, based on @christianewald idea.
The main difference is that you download first a list with all the activities to download, and then you use a Python script to download all one by one (so you need to run the script several times because every time only downloads 5 files).

does not work for me. Cannot find the content of export_activity_list.js

@mato1092

This comment has been minimized.

mato1092 commented Oct 23, 2018

I got an other solution of these problem.
You can login to runtastic and request all your stored data (Profile > Settings > Export). You will get an email with a download link.
I wrote a little java based parser, which converts all activities in this package to gpx files.
See solution here: https://github.com/mato1092/runtastic-activity-lib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment