Last active
April 2, 2022 14:42
-
-
Save arjanfrans/7bbd1f800b0c4a07c4c048f4bf4fd73f to your computer and use it in GitHub Desktop.
Get curl download commands for all links on a page
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
function printDownloadLinks(){ | |
var output = ''; | |
var pdfs = document.querySelectorAll("body > center > table > tbody > tr > td > a") | |
for(var i=0; i<pdfs.length; i++) { | |
var link = pdfs[i].href; | |
var name = link.split('/').reverse()[0]; | |
output += `curl -O ${link} -A "Mozilla/4.0\n\n"` | |
} | |
console.log(output); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment