www.nico.schottelius.org/blog/how-to-extract-your-amazon-...

74 lines
2.2 KiB
Markdown

[[!meta title="How to extract your Amazon ebooks from the Android Kindle App"]]
## TL;DR
The ebooks of the Amazon Kindle app can be found on your
Android phone in PRC format below the folder
***/data/media/0/Android/data/com.amazon.kindle/files/***.
## Download the books
To be able to extract your books from your Android phone, you need to
synchronise the books first, so they are available on your device.
To ensure they are local. turn of all network connections
(wifi, mobile data) and try to read them.
## Finding the files
At first I guessed the files I was looking for may be
ending in ***.azw***. Looking for these files, however
did not reveal any file.
My second guess was to look for amazon files or folder
named amazon:
% find / -name \*amazon\* 2>/dev/null
I found **/data/data/com.amazon.kindle**, with the following content:
% ls
app_com.amazon.device.syncHIGH app_metricsNORMAL databases
app_com.amazon.device.syncNORMAL app_web_cache files
app_dex app_web_database lib
app_dexopt app_webview shared_prefs
app_metricsHIGH cache
Looking for books in this directory wasn't successful.
However, the databases directory looked interesting.
% cd databases
% grep -ri mybookname *
Binary file databases/kindle_library.db matches
Binary file databases/kindle_library.db-journal matches
I used sqlite to have a look at the database:
% sqlite3 kindle_library.db
sqlite> .schema
...
This revealed one interesting table named ***LocalContent***.
Looking at it closer:
sqlite> select * from LocalContent;
This revealed the emulated path
***/storage/emulated/0/Android/data/com.amazon.kindle/files/***
and referenced ***.prc*** files.
I looked for them in the filesystem using ...
% find / -name \*.prc 2>/dev/null
... and found my books!
To extract the ebooks to your computer, you can use any file copy program.
The ***rsync*** utility however is suited for it very well, as it can
(re-)sychronise the whole folder:
% rsync -av /data/media/0/Android/data/com.amazon.kindle/files/ mycomputer:mybooks/
[[!tag amazon android kindle ebook hack]]