Skip to content

Instantly share code, notes, and snippets.

@Neener54
Created February 14, 2018 06:25
Show Gist options
  • Save Neener54/f4fc04006e7f5280af25303e5072b3b2 to your computer and use it in GitHub Desktop.
Save Neener54/f4fc04006e7f5280af25303e5072b3b2 to your computer and use it in GitHub Desktop.
Download all humble bundles
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())) {
downloadCmd += 'wget --content-disposition "' + a.href + "\"\n";
}
}
var output = document.createElement("pre");
output.textContent = downloadCmd;
document.getElementById("papers-content").prepend(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment