Skip to content

Instantly share code, notes, and snippets.

@YazzyYaz
Created June 8, 2020 01:21
Show Gist options
  • Save YazzyYaz/4f06911b1b918cfcd9ba8b5b5954312e to your computer and use it in GitHub Desktop.
Save YazzyYaz/4f06911b1b918cfcd9ba8b5b5954312e to your computer and use it in GitHub Desktop.
Nakamoto Institute Literature PDF Downloader
/*
Copyright: Yaz Khoury 2020
License: MIT
Script to bulk download all PDFs on Nakamoto Institute Literature
Instructions:
Go to: https://nakamotoinstitute.org/literature/
Open DevTools in Chrome
In the console, copy paste the following code.
It'll bulk-download all available PDFs.
Note: It doesn't download all the literature as many don't have PDF versions.
*/
rows = document.getElementsByTagName('TR');
for (var i = 1; i < rows.length; i++) {
row = rows[i].getElementsByTagName('TD')[1];
if (row.getElementsByTagName('A')){
a_array = row.getElementsByTagName('A');
for (var j = 0; j < a_array.length; j++){
if (a_array[j].innerHTML == 'PDF'){
link = a_array[j].href;
a_array[j].download = link;
a_array[j].dispatchEvent(new MouseEvent('click'));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment