Removing DRM (Completely) From EBooks
by kenizl86 in Circuits > Software
136 Views, 0 Favorites, 0 Comments
Removing DRM (Completely) From EBooks
Are you tired of companies telling you hat to do, commanding you with restrictive manacles on your electronic items? Well break your bonds! Be free! Summon forth thine energies and use your rippling muscles to emancipate yourself from your iron-bound prison-of-restrictions!
What is a DRM you may ask? Well, DRM stands for something; particularly something to do with digital items. Right now I'm a little foggy on the details as to what the letters stand for, but currently I'm too lazy to actually look up what the acronym is, so you can do so at you own leisure.
This Insctructable (in case you haven't quite figured it out yet) is purposed towards freeing your books from that pesky bond called DRM. This Instructable's duty is to tell you how to manumit your eBooks so that you can put those books on any device you want! Now this is in no way condoning copying the book and giving it away for free. Rather, this guide is to show you how you can remove the DRM from any eBook; completely, and unequivocally so that you can convert said book to other formats.
*NOTE: Just to say to anyone who is most definitely going to say it to me at some point - THIS ARTICLE IS NOT CONDONING PIRACY. In fact, people can already easily pirate the DRM copy of the book, so having a DRM-free copy will in no way condone more piracy than there already is. Also, let it be known that there are many more guides like this one that describe how to remove DRMs, but this one aims to be different in that you will hopefully be able to remove DRMs from any books.
Scenario
It's the beginning of the semester, and you need an English book. "Well gee, I have a computer, and I know some peeps with Kindle's; and hey, I ain't about to pirate my books for class! Ain't nobody got time for that!", you exclaim to yourself. "So why not get my book digitally from Amazon?!?"
So you make your way to your book, but then: "What the what the?!? $180 for an English book! Nuh-uh! That ain't happenin!"
So you see a link off to the side: "Hey! Rent from $100! Now that's more like it! And hey, looky there! I can get it for Kindle PC and read it on my compy! Sweetest deals! Imma buy that sucka!!"
A few days later you get the bright idea to get a Kindle, thinking you can read some awesome jank on your spiffy new gadget, but to your dismay as you send the book to your device: "Wha.....? I can't read ma dang $100 book on my dang $100 thingy-majig?!? FORMAT NOT SUPPORTED?!?! RAWR!!!!!!!"
Well no need for yelling, cuz I know exactly how you feel. Exactly.
Read on to discover how to win free your books!
Get on With It!
Okay, enough with the intro-ness; on to the good, gooey stuff!
Firstly, let it be known that this was all done on a windows machine. However, I am confident this could work on Linux (or possibly Mac, but I'm not entirely sure). Almost all these tools are cross-platform.
Anyways, the first thing you need to do is get access to the books you want the DRM gotten rid of. If you use Amazon (and their devices), then the quickest way is to download Kindle for PC and download all the books you want from the cloud to the app. The files are then downloaded to C:\[User name]\My Documents\My Kindle Content
Once you have access to said books, note what format they're in. It's just good to know that's all.
Tools and Tools
After that, you'll be needing to download Calibre. This is the eBook cataloger and converter of choice for many. You can download it from here: http://calibre-ebook.com/download
After you have Calibre downloaded and installed, you'll need to download a niffty set of tools by Alf: https://apprenticealf.wordpress.com/
Download the tools, not the plugin. You'll need the full set for what we're doing. Once you download it, unzip the stuff to a niffty place where you can easily reach them.
Okay, so these tools contain a few things. First, the plugin that goes into Calibre. This plugin will automatically remove DRMs from books as they are being imported into the Calibre library. Pretty sweet huh? The thing is, sometimes this doesn't work (more on that later), so you'll be needing the Windows (or Mac) app version of these tools (the other parts of these tools).
Now in order to make these tools work on their own (which is what we need), you'll need to install python; but not just any python, Python 2.7. Then, not only do you need that, you need to also install PyCrypto, which is an addon to python to handle compression and encryption. You can get this here: http://www.voidspace.org.uk/python/modules.shtml
You must get it from that website, because there are others from Diltz or whoever. These are the ones we need though, the ones from Voidspace. Make sure you download and install the correct PyCrypto for the correct system and Python.
Putting It All Together...
Now here comes the very numerous part. The reason I say that is because this part has numerous things to do in it (intuitively named huh?).
First, install Python and PyCrypto (in that order) if you have not already. Next, launch Calibre and in the top toolbar open up the preferences. Look for the "Plugins" button and click it. Then, click on "Load plugin from file". Now go to the folder that came from the Alf tools zip-file and look for the folder that says something to the effect of "DeDRM calibre plugin". Open up that and select the .zip file as the plugin and install it. Now restart Calibre after installing the plugin.
And there you have it! Automatic De-DRM-ing!
But wait, what about rental books? What about other books where you aren't the original owner? Well, I figured a way around the first one, but have yet to encounter the second so I can't really do anything about that for you.
In order to effectively be able to convert rental books, you'll need to use the app version of the Alf tools. The way to do this is simple. Navigate to the file "mobidrdrm.py". Mine was located here: "alf_dedrm_tools\DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\lib"
Before this next part, go ahead and make a backup of this file in case anything goes wrong.
Now open the file in a text editor and locate the word "val406" using any type of locating mechanism you desire. Then, delete that whole line that contains it and the one after. Effectively we are deleting these lines:
if val406 != 0: raise DrmException(u"Cannot decode library or rented books")
I personally like to use Notepad++ because it's flipping awesome, but to each his own.
Killing the DRM
So now you have completed all of that stuff. What next?
Well, if you have regular books, just import them into Calibre. But if you have rentals, then put them through the "DeDRM_App.pyw" script. This will definitly get rid of the DRM. If you wish, you could just use the Python script for all your books, but if you wish to convert and edit metadata, best import it into Calibre.
One thing that I've noticed is that AZW4 books from Amazon are screwey. You put them through all this and convert them to PDF with Calibre (because an AZW4 file is basically a glorified PDF file), you get these funky books with about 9 words per page. What I've found best to do when dealing with these nuisances is to use a plugin called KindleUnpack after you've De-DRM-ed them. This plugin can be found here. This is a Calibre plugin, so install it the same way you did with the Alf tools. You'll need to restart Calibre again before you can use it.
Fin
Well, I hope you found this informative and helpful! Let me know if there's anything that needs changing or whatever, mostly because I did this hopped up on ice cream at 12:30 at night.
Power to the free humans!