Created
January 1, 2019 19:52
-
-
Save DaniGuardiola/d49a72c828b4b373fe3fbd5815ef2df5 to your computer and use it in GitHub Desktop.
Download Humble Bundle books
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
// IMPORTANT! This doesn't work properly yet, it's a WIP | |
// - Go to the library page and select "ebooks" | |
// - Copy and paste the code below into the Javascript console | |
// - Run X() to download all ebooks | |
// - Enjoy! | |
list = [...document.querySelector('.column.subproducts-holder').children] | |
x = n => { | |
link = list[n] | |
link.click() | |
button = [...document.querySelectorAll('.js-download-button.download-button')].find(el => el.textContent.toLowerCase().includes('epub')) | |
if (!button) return console.warn('Title doesn\'t have EPUB version available') | |
button.click() | |
} | |
_X = i => { | |
if (i < 0) return | |
x(i) | |
i-- | |
return setTimeout(() => _X(i), 1000) | |
} | |
X = () => _X(list.length - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment