Skip to content

Instantly share code, notes, and snippets.

@mrkrstphr
Last active May 26, 2024 18:18
Show Gist options
  • Save mrkrstphr/0ddb2ecf9c15f506eeafbe0aa41da7cf to your computer and use it in GitHub Desktop.
Save mrkrstphr/0ddb2ecf9c15f506eeafbe0aa41da7cf to your computer and use it in GitHub Desktop.
Copy All HumbleBundle Download Links

Copy All HumbleBundle Download Links

I frequently buy books and comic books from HumbleBundle. It's kind of an obsession, whether I manage to read them all, or not.

I also like to use Motrix to manage downloading lots of files. HumbleBundle has a bulk download link which just fires off a ton of browser downloads, but I've found that sometimes using that features results in missing a download or two.

And clicking the download links one-by-one is boring.

I just want to get a list of download URLs so I can paste them into Motrix at once and have it manage downloading them.

So I wrote a quick snippet to paste into the browser developer tools to find all the download links on any given page and output them to the console so I can copy it.

Note: the URLs provided by HumbleBundle eventually expire, so don't hold on to the copied links too long without using them.

To use, simply change the file type you want in the second join (.epub, .mobi, .pdf, etc), then paste the link in your browsers developer tools.

The snippet can probably be modified to get rid of the first filter.

Enjoy!

console.log(
Array.from(document.querySelectorAll('.row'))
.map((r) => {
const links = Array.from(r.querySelectorAll('a'));
const cbz = links.find(l => l.href.includes('.cbz'))?.href;
const epub = links.find(l => l.href.includes('.epub'))?.href;
const pdf = links.find(l => l.href.includes('.pdf'))?.href;
return (cbz || epub || pdf);
})
.filter(Boolean)
.join('\n')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment