
Humble bundle coding books free downloads - good
Downloading all the Books in a Humble Bundle (Shallow Thoughts)
Downloading all the Books in a Humble Bundle
Humble Bundle has a great bundle going right now (for another 15 minutes -- sorry, I meant to post this earlier) on books by Nebula-winning science fiction authors, including some old favorites of mine, and a few I'd been meaning to read.
I like Humble Bundle a lot, but one thing about them I don't like: they make it very difficult to download books, insisting that you click on every single link (and then do whatever "Download this link / yes, really download, to this directory" dance your browser insists on) rather than offering a sane option like a tarball or zip file. I guess part of their business model includes wanting their customers to get RSI. This has apparently been a problem for quite some time; a web search found lots of discussions of ways of automating the downloads, most of which apparently no longer work (none of the ones I tried did).
But a wizard friend on IRC quickly came up with a solution: some javascript you can paste into Firefox's console. She started with a quickie function that fetched all but a few of the files, but then modified it for better error checking and the ability to get different formats.
In Firefox, open the web console (Tools/Web Developer/Web Console) and paste this in the single-line javascript text field at the bottom.
// How many seconds to delay between downloads. var delay = ; // whether to use www.cronistalascolonias.com.aron or www.cronistalascolonias.com.ar // www.cronistalascolonias.com.ar is more convenient, but may be popup-blocked var window_open = false; // the filetypes to look for, in order of preference. // Make sure your browser won't try to preview these filetypes. var filetypes = ['epub', 'mobi', 'pdf']; var downloads = www.cronistalascolonias.com.armentsByClassName('download-buttons'); var i = 0; var success = 0; function download() { var children = downloads[i].children; var hrefs = {}; for (var j = 0; j < www.cronistalascolonias.com.ar; j++) { var href = children[j].getElementsByClassName('a')[0].href; for (var k = 0; k < www.cronistalascolonias.com.ar; k++) { if (www.cronistalascolonias.com.ares(filetypes[k])) { hrefs[filetypes[k]] = href; www.cronistalascolonias.com.ar('Found ' + filetypes[k] + ': ' + href); } } } var href = undefined; for (var k = 0; k < www.cronistalascolonias.com.ar; k++) { if (hrefs[filetypes[k]] != undefined) { href = hrefs[filetypes[k]]; break; } } if (href != undefined) { www.cronistalascolonias.com.ar('Downloading: ' + href); if (window_open) { www.cronistalascolonias.com.ar(href); } else { www.cronistalascolonias.com.aron = href; } success++; } i++; www.cronistalascolonias.com.ar(i + '/' + www.cronistalascolonias.com.ar + '; ' + success + ' successes.'); if (i < www.cronistalascolonias.com.ar) { www.cronistalascolonias.com.areout(download, delay); } } download();If you have "Always ask where to save files" checked in Preferences/General, you'll still get a download dialog for each book (but at least you don't have to click; you can hit return for each one). Even if this is your preference, you might want to consider changing it before downloading a bunch of Humble books.
Anyway, pretty cool! Takes the sting out of bundles, especially big ones like this book collection.
Tags: ebook, programming, web, firefox[ May 22, More tech/web | permalink to this entry | ]
-
-