Last active
March 15, 2019 23:41
-
-
Save calexandrepcjr/22941abf509b253cd9bdff22d79e9959 to your computer and use it in GitHub Desktop.
How to download all the Humble Bundle Books after purchase
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
# Main inspiration/initial credits: https://gist.github.com/graymouser/a33fbb75f94f08af7e36 | |
# Open the console and run this js: | |
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 += a.attributes['href'].value + "\"\n"; | |
} | |
} | |
var output = document.createElement("pre"); | |
output.textContent = downloadCmd; | |
document.getElementById("papers-content").prepend(output); | |
# All the links will appear inside a block. Copy those links to a txt file and in the same directory, run: | |
wget --no-check-certificate --content-disposition -r -H -np -nH -N --cut-dirs=1 -e robots=off -l1 -i ./books.txt -B 'https://dl.humble.com/' | |
# If content disposition does not work, just rename the files with traditional regex, or, in windows with PERL: | |
# find . -type f | perl -pe 'print $_; s/(\@gamekey=)+.*//' | xargs -n2 mv | |
# Replacing books.txt for your txt filename. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment