Skip to content

Instantly share code, notes, and snippets.

@kisel
Last active July 5, 2016 17:55
Show Gist options
  • Save kisel/d0034da0f20370bdf8425d4a8003769e to your computer and use it in GitHub Desktop.
Save kisel/d0034da0f20370bdf8425d4a8003769e to your computer and use it in GitHub Desktop.
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 .tcx format. Runtastic removed this feature wich makes it very difficult to change your tracking service, thanks for that.

Fork changes: it downloads .tcx instead of .gpx and supports large files(original implementation fails with Netowork error and the Downloads page crashes due to huge size of a.href)

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] + '.tcx',
        filename = 'RUNTASTIC-' + value[1] + '-' + value[0] + '.tcx';


    $.ajax({
        url: 'https://' + app_config.domain + user.run_sessions_path + id + '.tcx',
        success: function(data, textStatus, jqXHR)
        {
            if(textStatus == 'success')
            {
	        var file = new File([jqXHR.responseText], filename, {type: 'plain/text'});
	    
                $('<a/>', {
                    'href' : URL.createObjectURL(file),
                    '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', ' ');
        },
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment