7

Where are Amazon Kindle ebooks located on my Linux PC after I download them for offline reading with the "Kindle Cloud Reader" Chrome app, & how do I convert them to PDF format?

For Windows this seems to be the answer:

For MacOS this seems to be the answer:

But for Linux there doesn't seem to be an answer. :(

My aim is to convert the Kindle ebook to a PDF format (which I much rather prefer) for offline reading on any device. Enough of this proprietary "read through Kindle app only" garbage. I'm on Linux for Heaven's sake!


Update: in ~/.config/google-chrome I have the following:

gabriels:~/.config/google-chrome$ ls
Avatars                       pnacl
BrowserMetrics                Profile 1
BrowserMetrics-active.pma     Profile 2
BrowserMetrics-spare.pma      Safe Browsing
Certificate Revocation Lists  Safe Browsing Channel IDs
CertificateTransparency       Safe Browsing Channel IDs-journal
Consent To Send Stats         Safe Browsing Cookies
Crash Reports                 Safe Browsing Cookies-journal
Dictionaries                  ShaderCache
FileTypePolicies              SingletonCookie
First Run                     SingletonLock
Guest Profile                 SingletonSocket
Local State                   SSLErrorAssistant
NativeMessagingHosts          Subresource Filter
OriginTrials                  System Profile
PepperFlash                   Webstore Downloads
  • What do you have in ~/.config/google-chrome? – muru Mar 5 '18 at 7:49
  • See above in question. – Gabriel Staples Mar 5 '18 at 7:55
  • Also, sudo find . -iname \*kindle\* in my home dir found nothing. – Gabriel Staples Mar 5 '18 at 7:57
  • Do either of those profile directories contain a databases directory? Since the Windows answer says the file is called https_read.amazon.com..., I'd look for something like that instead. – muru Mar 5 '18 at 8:06
  • 1
    Since the SO post for Windows says "Looking at the database in Sqlite Browser, it seems that the books are broken apart into thousands of fragments", I'm not sure what you were expecting. You might want to try the Kindle application on Wine, though I hear that it's not easy to get the books from recent versions of that either. – muru Mar 5 '18 at 8:28
10

How to convert purchased Amazon eBooks to PDF format:

This is a hard problem. However, I have a solution, but Linux users (including myself) aren't going to like it.

First off, let me say: DON'T STEAL BOOKS OR ANYTHING ELSE! BUY THEM! PAY AUTHORS FOR THE THOUSANDS OF HOURS THEY PUT INTO THEIR CRAFT AND THEN WRITING ABOUT IT. I'm going to explain how to do some things but DON'T STEAL BOOKS. This assumes you have PURCHASED AN EBOOK and are just PISSED OFF THAT WITH THAT PURCHASE YOU DON'T HAVE THE FREEDOM TO READ IT AS A PDF (A FREEDOM WHICH I THINK YOU SHOULD HAVE).

Also, there are possibly other paths to accomplish what I'm about to describe. If I see a possible alternate path I'll mark it with the word "clue", so watch for those and head down those paths to write your own improved answer if you wish.

1) Get the eBook from Amazon onto your PC for "offline reading"

What you need is the Kindle App "for PC & Mac": https://www.amazon.com/kindle-dbs/fd/kcp. However, don't use this link to download it, because the current version as of 5 Mar. 2018 is 1.21 Build 48017, and all versions after Kindle for PC 1.17 use a new "KFX format" which is currently uncrackable.

Clue: go crack the KFX format. We will all thank you for it.

Now, turn off your Ubuntu computer and boot into Windows.

Clue: You may be able to do this using Wine or by installing Windows 10 for free into a virtual machine inside Ubuntu instead.

So, go download an old version of the "Kindle for PC" app here:

https://kindle-for-pc.en.uptodown.com/windows/old. You must use version 1.17 or earlier for this to work. I used 1.16 Build 44025.

Install the App. Log in with your Amazon account, right-click the ebook you want, and go to "Download."

This will save it on your PC for offline viewing. You'll now find your downloaded book as a ".azw" file in "C:\Users\MY_USERNAME\Documents\My Kindle Content". For ex: "C:\Users\MY_USERNAME\Documents\My Kindle Content\B08137WHQ_EBOK.azw".

Clue: later versions of the Kindle for PC app will give you a folder with that name containing several other files instead, such as ".azw", ".azw.md", and ".azw.res". Apparently this is the new, uncrackable "KFX" format. Go crack it!

Clue: There is also a Chrome App called "Kindle Cloud Reader." You can install it and download your book for offline viewing too, but it uses a different format too. See comments under my question. On Windows you can find its offline book contents under the hidden folder "C:\Users\MY_USERNAME\AppData\Local\Google\Chrome\User Data\Default\databases\https_read.amazon.com_0". It contains, for example, two files named "85" and "86", with no file extension, but one is clearly the book since it's a few MB, while the other is 44KB or so. On Linux you can do a find in your home directory to find this location with sudo find . -iname \*amazon\*. I found the folder in: "~/.config/google-chrome/Profile 1/databases/https_read.amazon.com_0".

2) Remove the "Digital Rights Management" (DRM) from the .azw file so you can read the eBook using non-Amazon software.

In short: DRM sucks. If you're an author, don't do that crap! Just sell digital PDFs on Gumroad instead (Update: LeanPub may be a better option instead!).

To remove the DRM from the file we are going to use "DeDRM Tools 6.5.5": https://apprenticealf.wordpress.com/2017/10/20/dedrm-tools-6-5-5-released/.

Download it from GitHub here: https://github.com/apprenticeharper/DeDRM_tools/releases. Notice that the release notes state: "This release does not include any support for the KFX format Kindle ebooks that are often downloaded when using Kindle for PC/Mac 1.19 or later."

Click the GitHub link to download "DeDRM_tools_6.5.5.zip", then extract the zip file so you can find the "DeDRM_calibre_plugin" folder it contains.

Now go install the Calibre ebook reader for Windows 64-bit:

https://calibre-ebook.com/download. I'm using "calibre-64bit-3.18.0.msi".

Clue: I'm actually using this in Windows, but maybe you can get it to work in Linux, since Calibre has a Linux installation page too. DeDRM also contains some good notes you are about to need to help you out if you want to pursue this. See the readme you just extracted above here: "DeDRM_calibre_plugin\DeDRM_plugin_ReadMe.txt". It contains a rather confusing section (for me at least) titled "Linux Systems Only".

Install the DeDRM plugin:

Once Calibre is installed, open it up. Then go to "Preferences" --> "Advanced" section --> Plugins. Choose "Load plugin from file" then find your DeDRM .zip file in the unzipped folder from above. You're looking for "DeDRM_calibre_plugin\DeDRM_plugin.zip". Choose this plugin then click "Open" and "Apply."

Now click "Add books" in Calibre and go find the .azw file we previously downloaded using Kindle for PC 1.16 (1.17 or earlier). It will import it and automatically use DeDRM to remove the DRM crap!

You should now be able to open the eBook in Calibre for reading. Double click the book in Calibre to verify it opens up properly and is readable. It it works, all is well so far.

Clue: If in Windows this works flawlessly. If in Linux you may have to fight it with the readme file above, to get Wine and Python and stuff to all work right--I couldn't figure it out in Linux.

Almost there!

3) Convert the de-DRM'ed eBook to PDF!

Select the book in Calibre and click "Convert books" at the top. Choose "PDF" in the "Output format" drop-down box at the top-right of the window that pops up. You may now click "Ok" to do the conversion, OR (optionally) change a few quick settings first--as described below!

Optional:

  • Select "Page setup" first and make sure "Input profile" is set to "Default Input Profile" and "Output profile" is set to "Default Output Profile".
  • Select "Structure detection" and delete all text from the "Insert page breaks before (XPath expression)" box if you'd like the PDF to take up fewer pages by not forcing page breaks between every section and sub-section in the ebook.

Click "Ok" to convert the ebook to PDF! This took ~2 min for me on an eBook ~100 pages in length and 3 MB in size.

Done! Your ebook PDF is now located in your "Calibre Library" folder here: "C:\Users\YOUR_USERNAME\Documents\Calibre Library\EBOOK_AUTHOR\EBOOK_TITLE\EBOOK_TITLE.pdf".

You'll also find a nice (de-DRMed I think) ".azw3" file in the same location as well, in case you want to use Calibre or other generic eBook readers to read the book instead!

Copy the PDF or .azw3 file to your Ubuntu machine, as desired, and voila!--use your favorite ebook reader (ex: Calibre) or PDF viewer (ex: FoxitReader) to view your ebook as a PDF!

Foxit Reader (click here then go to "Free Foxit Reader Download") is great because it has awesome highlighting and comment tools to underline things, highlight, or take notes, and it is cross-platform (Windows, Mac, Linux, & others) and free as in "no-cost" (but not free as in open source!).

AND REMEMBER: DON'T STEAL! Buy the book and give the authors their hard-earned money! Encourage authors to sell PDFs (ex: via Gumroad like I do) (Update: LeanPub may be a better option instead!) instead of DRMed garbage.
But if you steal you are ruining the system. DRM might suck, but you don't have to suck too!

  • 1
    THIS WORKED! Thank you. It was a labyrinthine effort, to be sure. – Tom Mercer Jun 3 '18 at 20:15
  • 1
    Glad it helped! I'm a determined guy so I figured this out almost all in one sitting. What a pain! UPDATE TO AUTHORS: Please sell your PDFs on LeanPub! (leanpub.com) Down with freedom-sucking DRM B.S.! – Gabriel Staples Jun 3 '18 at 21:11
2

if you don't have Windows or Mac available, but Linux

  1. use the Kindle Cloud Reader at https://read.amazon.com in Chrome or Chromium to see your books and right-click, Pin&Download
  2. find the stored file with code provided above by Gabriel Staples: sudo find . -iname \*amazon\*
  3. use the tool provided at https://github.com/d10r/kindle-fetch (you need nodejs)
  4. it will provide you a huge html file of the whole book in some splitseconds
  • This looks like it may actually work. I'd have to try it. – Gabriel Staples Aug 13 '18 at 19:43
  • offline mode is disabled for me on read.amazon.com in Ubuntu 18.04 64-bit using chrome 71. – chovy Feb 6 at 17:48
1

Calibre has a Linux version, and the standard tool it supports for working with DRM now supports KFX.

You do need to have a version of Kindle for PC running on your computer, which depends on having Wine running. After various problems, there seems to be something about recent versions of kindle for PC, I got an older version running. Some as the original answer, Kindle v 1.16 Built 44025. I am running PlayOnLinux 4.2.12, Wine 3.0.2, in a 64bit virtual drive set to work as Windows 8.1, under Linux Mint 18.3 using Xfce.

So far, at least, I have not had any encounters with KFX files. but it's possible Amazon's use of that format could eventually force me to switch to a more recent Kindle version.

So, August 2018, the answer here works, the KFX encryption has been cracked, but I would like to have some assurance that some more recent version of Kindle for PC will work

  • Welcome to Ask Ubuntu1 :-) This looks like an answer and a question in one. For clarity, you can edit the existing answer with the new information, or edit your answer as, take out the last paragraph and ask a new question. (Sorry, this is a Q&A site, not a forum and we're a bit particular about this) – Fabby Aug 17 '18 at 10:15
0

@GabrielStaples , your answer provides the full path, but I wanted to add a potential improvement: I just tried to install the exact same Kindle for PC 1.16 to playonlinux and it works like a charm. Ebook file location will depend on how you set it on kindle (Tools/Options/Content/Change Folder), the default being /home/user/Documents/My Kindle Content

So, your answer remains correct, but now you don't need to reboot to your windows partition but can instead do it all from Linux.

  • 1
    oops, just saw that @dave bell provided the same answer, my bad – Ricardo Pietrobon Aug 19 '18 at 22:39
0

If you know how to use adb (that comes in android platform tools) you can write a small script that does -

  1. screengrab

    adb exec-out screencap -p > page1.png

  2. swipe

    adb shell input swipe 500 200 200 200 200

And repeat until pageN

then use imagemagic's convert tool to create a single pdf from all the image files

  • That's an interesting, albeit extremely non-ideal, solution. Any idea how long that might take to run? I encourage you to give it a shot and see how long it takes and how good it turns out. – Gabriel Staples Aug 18 at 3:37
  • 1
    I use it regularly to move important reference sections/formulas etc from phone to desktop. It's fast. – Sharun Aug 18 at 6:30

protected by Community Aug 15 at 10:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.