Create a gist now

Instantly share code, notes, and snippets.

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

works like charm . Thank you for sharing!

@antjamesbird

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

@bcambel
bcambel commented Mar 2, 2016

👍 life saver man! All data in Strava now!

@sougat818

A Million Thanks to you!

@hranicka

Thank you a lot!

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

With respect.

@christianewald
Owner

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

Worked fine with Chrome 49 on OSX. Thank you!

@23tux
23tux commented May 17, 2016 edited

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

YOU ARE A GENIUS, many thanks

@luisfgfurtado

Works like charm. Thank you!

@jonasbits

Works with Chrome 51.0.2704.84 on Win10

@joshre
joshre commented Jul 13, 2016

Marvelous, thanks!

@senden9
senden9 commented Aug 21, 2016

Thanks. Works also with Firefox 48

@davidbalazs

thank you, it helped me a lot!

@Dexter0912
Dexter0912 commented Sep 29, 2016 edited

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

przechwytywanie

@cdragicevic

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

Got the same problem...

@luemmel
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
luemmel commented Oct 3, 2016 edited

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
rbredow commented Oct 16, 2016 edited

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
Jagounet commented Nov 2, 2016

Thx its ok with firefox today 👍

@GOTAY
GOTAY commented Nov 8, 2016 edited

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

@GOTAY
GOTAY commented Nov 8, 2016

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

@mrhenki
mrhenki commented Nov 14, 2016 edited

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
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

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

@Metalnem
Metalnem commented Nov 28, 2016 edited

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
jcarias commented Jan 25, 2017

@Metalnem Thank's it worked like a charm!

@jozelito

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

@ScoutVik
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.

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