Skip to content

Instantly share code, notes, and snippets.

@DaniGuardiola
Created January 1, 2019 19:52
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 DaniGuardiola/d49a72c828b4b373fe3fbd5815ef2df5 to your computer and use it in GitHub Desktop.
Save DaniGuardiola/d49a72c828b4b373fe3fbd5815ef2df5 to your computer and use it in GitHub Desktop.
Download Humble Bundle books
// 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