Created
May 27, 2020 18:12
-
-
Save bennylope/cbab30c941ab5b7935bd93911bc88a4b to your computer and use it in GitHub Desktop.
Download your Papertrail gzipped archives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy and paste into your browser console window after loading | |
your archives page, e.g. with a selected long date range. | |
Original: https://www.reddit.com/r/javascript/comments/5my92r/console_script_to_click_all_download_links_on_a/dc7cktr/ | |
The problem I had with my first attempt was that there was no delay, | |
so I was only downloading the last entry on the page. The linked | |
solution above pointed to the problem (each subsequent request was | |
killing the preceding request) which was including a delay. Here | |
I used 1.5 seconds, which should probably be bumped up just a little | |
bit since it missed a few entries. | |
Make sure your browser handles *.gz files by downloading them without | |
any prompt. | |
*/ | |
var elements = document.getElementsByClassName("right btn-links sm"); | |
var counter = 0; | |
var interval = setInterval(function () { | |
elements[counter].children[0].click(); | |
counter++; | |
if ( counter > elements.length ) { | |
clearInterval(interval); | |
} | |
}, 1500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment