Update: This tutorial is largely superseded by the much nicer and easier 'Kindle For PC' method: see it here.
UPDATE 2: included Preston Lee's online PID generator.
D got a big fat tax refund, so she recently bought one of those new-fangled Amazon Kindle thingies for purchasing and reading books in an electronic form. (She loves it.)
I like to read books in an electronic form on my iPhone, but find that it's pretty hard to come by them legally; there are many different sellers and formats, some of which have certain books but not others. Sometimes they have the book, but not in a format I can do anything with. It's generally easier just to illegally download them from torrent sites.
Amazon has tons and tons of books available for Kindle, and have chosen the standard MobiPocket format as the one their reader uses, meaning it is theoretically trivial to purchase them and convert them to something else. Except that they won't sell them to you unless you have already purchased a $400ish Kindle on which to read them. Meaning you don't need to convert them...
In any case, now that our household has a Kindle, it frees me up to purchase books from Amazon in Kindle format without actually having a Kindle myself. I then just remove the DRM that Amazon puts in the files (to keep people from converting them, natch), and then convert them to HTML or txt to read in Books.app on iPhone. Want to know how to do the same thing?
Step 1) Find someone with a Kindle.
Step 2) On their Kindle, go to the Settings menu, and type '411' on the keypad. This will bring up a little information dialog with a bunch of things in it, of which you only need the Serial. It is a 16-character string of letters and numbers. Write it down.
Step 3) Ask the Kindle's owner to buy a book for you. Give them some money so you don't look like a mooch. Once you've given them the money, ask them to log in to their Amazon account and navigate to their 'Kindle Downloads' page from your computer. When they complain, mention that you've already given them money. The Kindle Downloads page will list all the books they've purchased, and yours should be right at the top. Click 'Download to computer' and you'll get a file named 'Title-of-Book.azw'
Step 4) Download MobiDeDRM.zip, which is a small suite of Python scripts that some kind soul wrote and then distributed through links that expire all the time and can be kind of a pain to track down. I've hosted them from my site so that they won't expire. This .zip file contains mobidedrm.py, mobidedrm2.py, kindlepid.py and mobihuff.py.
(These scripts require that you install Python on your system, which is something outside the scope of this howto. I'm on linux, but there's a Python for Windows called "ActiveState Python." Google will help.)
After unzipping the archive, open up a terminal window and pass the Kindle's serial # (which you previously wrote down) to kindlepid.py. Something like this:
python kindlepid.py XXXXXXXXXXXXXXXX
Where all those Xs are replaced with the Kindle serial number. It will return something that looks like this:
Mobipocked PID for Kindle serial# XXXXXXXXXXXXXXXX is Z1QFCDQ*74
where my 10-character gibberish string is replaced with the one you made note of in the last step. This will take about a minute, and when it finishes you'll see:
Decrypting. Please wait... done
Now you will have a decrypted MobiPocket-formatted ebook that you can read in any MobiPocket reader.
If, however, you want to convert it to HTML to read on any device you wish, you'll want to install MobiPerl. (This, of course, will require you to install Perl. MobiPerl's website will walk you through that.)
6) With MobiPerl installed, do this:
This will create a directory named 'unpacked' that will contain Title-of-Book.html
Things that can go wrong:
Amazon seems to compress longer books in a slightly different manner than shorter books. If your resulting .mobi file and/or .html file are oddly gibberishy (for example, if the first line starts in the middle of a sentence, and clearly not the beginning of the book), let's go back to step 5.
Step 5b) These 'huffdic-compressed' books require a slightly different script to remove the DRM. Do this:
This script will output the .html file in the directory from which you are running it.
All in all, this is as much of a pain as it looks, but the selection and availability of books on Amazon makes it worthwhile to me. They have far more books than The Pirate Bay does, and I feel better paying for them
Update: several readers have alerted me that there's a much newer version of mobiDeDRM available. You can download it here.
This is great! I'm sure it could be easily automated so that anyone could do it. As soon as everything got installed, it would just be a matter of creating a gui that keeps track of IDs and runs the python and perl scripts and then the process should be rather painless.
Yes, what a pain! I'd like to be able to look at the occasional kindle document without having the friend with a Kindle, cuz I don't have one! I have read that one can change the files to pdfs somewhere. Thanks for info. I'm just going to wait to pick up a used Kindle after they're not so new.
The author lives in Vancouver, Washington, USA with his girlfriend and a menagerie of cats, rats, fish, birds, guinea pigs and robots.
Among other inanities, he strives to use investigative techniques to work young starlet breasts into every aspect of rational discourse -- focusing on the discourse, thus making it not perverted. Also, has recently begun a career as "Internet hairstylist."
He can be contacted via email and Jabber IM at 'firstname.lastname@example.org'. He likes to be contacted.
(All press inquiries, however, ought be directed towards the author's agent, Alistair Hoel, via email to email@example.com.)