Skip to content

Instantly share code, notes, and snippets.

@parasquid
Last active June 11, 2018 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parasquid/31e1743f122b981511dd74d18c23024e to your computer and use it in GitHub Desktop.
Save parasquid/31e1743f122b981511dd74d18c23024e to your computer and use it in GitHub Desktop.
generate a wgettabl download list of all books in humble bundle
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);
parallel --lb < download.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment