Last active
May 10, 2023 05:36
-
-
Save thunder-coding/ff0424956bf199277cd2ac65e4a3bbff to your computer and use it in GitHub Desktop.
Download all pdf on 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
const anchors = Array.from(document.getElementsByTagName('a')); | |
const links = anchors.map(anchor => anchor.href.toString()); | |
const pdfs = links.filter(link => link.endsWith('.pdf')); | |
let clipboardText = ''; | |
for (const pdf of pdfs) { | |
clipboardText += `curl '${pdf}' -Lo '${pdf.substr(pdf.lastIndexOf('/') + 1)}'\n` | |
} | |
setTimeout(() => navigator.clipboard.writeText(clipboardText), 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment