Create a gist now

Instantly share code, notes, and snippets.

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', ' ');
        },
    });
});

works like charm . Thank you for sharing!

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

bcambel commented Mar 2, 2016

👍 life saver man! All data in Strava now!

A Million Thanks to you!

Thank you a lot!

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

With respect.

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)

Worked fine with Chrome 49 on OSX. Thank you!

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!

YOU ARE A GENIUS, many thanks

Works like charm. Thank you!

Works with Chrome 51.0.2704.84 on Win10

joshre commented Jul 13, 2016

Marvelous, thanks!

senden9 commented Aug 21, 2016

Thanks. Works also with Firefox 48

thank you, it helped me a lot!

Dexter0912 commented Sep 29, 2016 edited

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

przechwytywanie

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.

Got the same problem...

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

Thx its ok with firefox today 👍

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

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

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

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

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

@Metalnem Thank's it worked like a charm!

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

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.

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

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

ERueland commented May 16, 2017 edited

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

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

@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 commented May 19, 2017

Thank you man!

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.

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!

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

AntonioO68 commented Jul 8, 2017 edited

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!

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 commented Jul 20, 2017

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

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