Last active
June 11, 2018 17:02
-
-
Save parasquid/31e1743f122b981511dd74d18c23024e to your computer and use it in GitHub Desktop.
generate a wgettabl download list of all books in humble bundle
This file contains hidden or 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
var pattern = /(MOBI|EPUB|PDF( ?\(H.\))?|CBZ|Download)$/i; | |
var nodes = document.getElementsByTagName('a'); | |
var downloadCmd = ''; | |
for (i in nodes) { | |
var a = nodes[i]; | |
if (a && a.text && pattern.test(a.text.trim()) && a.attributes['href']) { | |
downloadCmd += 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 20 -c --content-disposition "' + a.attributes['href'].value + "\"\n"; | |
} | |
} | |
var output = document.createElement("pre"); | |
output.textContent = downloadCmd; | |
document.getElementById("page-top-messages").prepend(output); |
This file contains hidden or 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
parallel --lb < download.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment