daily pastebin goal
2%
SHARE
TWEET

garmin connect bulk export js

a guest Sep 16th, 2016 5,159 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Here's javascript that can be run in any modern browser fairly simply in javascript. Might be easier to set up than Python.
  3.  
  4. You'll want to pre-set a download location in your browser settings to some folder, name it TCX or something, and tell your browser to auto-download there, or else you'll get a ton of popup save dialogs.
  5.  
  6. First Navigate to the last (most recent) activity you have in Garmin Connect (as in https://connect.garmin.com/modern/activity/5555555555 ), then hit F12 (should work in chrome/IE) to open dev tools to get to the Javascript Console. Then paste the below code and hit enter to run it. Can change ttl from 100 to whatever # of activities you want to download.
  7. If you want a different format, change the "tcx" part of the URL to the appropriate format acronym if garmin supports it.
  8. If your connection is too slow to do a full download in less than 3 seconds every time, change the downloadTimeoutLength from 3 * 1000 to whatever number you want (it's 3*1000 because that's 3000 milliseconds = 3 seconds).
  9.  
  10. [CODE]*/
  11. var a = window.location.pathname.split("/");
  12. var id = a[a.length-1];
  13. var tcxUrl = "https://connect.garmin.com/modern/proxy/download-service/export/tcx/activity/";
  14. var cnt = 1, ttl = 100; /*Change ttl from 100 to whatever # of activities you want to download*/
  15. var downloadTimeoutLength = 3 * 1000;
  16. var downloadUrl = tcxUrl + id;
  17. window.location.href = downloadUrl;
  18.  
  19. setTimeout(
  20.    (getMore = function(){
  21.     jQuery.getJSON("https://connect.garmin.com/modern/proxy/activity-service/activity/"+id+"/relative?_="+Math.random()
  22.         ,function(d){
  23.             id = d.previousActivityId;
  24.             downloadUrl = tcxUrl + id;
  25.             window.location.href = downloadUrl;
  26.             if(++cnt<ttl){
  27.                 setTimeout(getMore,downloadTimeoutLength );
  28.             }
  29.         }
  30.     );
  31.    })
  32.    ,downloadTimeoutLength
  33. );
  34. /*[/CODE]
  35.  
  36. It goes from most recent back downloading each one. If you don't put the right total # to download them all, just navigate to the last one it got and re-run from there.*/
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top