Skip to content

Instantly share code, notes, and snippets.

@arjanfrans
Last active April 2, 2022 14:42
Show Gist options
  • Save arjanfrans/7bbd1f800b0c4a07c4c048f4bf4fd73f to your computer and use it in GitHub Desktop.
Save arjanfrans/7bbd1f800b0c4a07c4c048f4bf4fd73f to your computer and use it in GitHub Desktop.
Get curl download commands for all links on a page
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