Kindle & epub
Latest update:
I had been happily reading Matt Levine's column via email, until the
emails stopped coming. I tried to resubscribe, but to no
avail.
Thence I looked into the corresponding Bloomberg RSS feed to discover
that its XML didn't contain any article text, only links to their
website. It forced me to write a scraper that generated .mobi
files using ebook-convert utility from Calibre like so:
$ ebook-convert 1.xhtml 1.mobi --level1-toc //h:h2
$ echo hello | mailx -a 1.mobi -- USER@kindle.com
That file successfully arrived to my Kindle, but afterwards I got
this:
From: Amazon Kindle Support <do-not-reply@amazon.com>
Date: Thu, 15 Sep 2022 18:41:47 +0000
Subject: An update about sending MOBI documents to your library
... We noticed that the following document(s), sent by you at
06:41 PM on Thu, Sep 15, 2022 GMT are in MOBI (.mobi, .azw) formats:
* 1.mobi
We wanted to let you know that starting August 2022, you'll no longer
be able to send MOBI (.mobi, .azw) files to your Kindle library.
(So-called Eternal August. The rest of the email was 'better send an
epub next time'.)
With the command above, Calibre creates 'classic' .mobi files; .azw is
virtually the same thing.
In the past, Amazon freely distributed Kindlegen program. Using its
most recent version (2.9, hasn't been updated since 2014) you can
produce a different mobi variant. Typing
$ kindlegen foo.html -o foo.mobi
will make a hamburger that contains 3 layers inside:
1. a classic .mobi
2. Amazon's proprietary KF8 (a format similar to epub3)
3. the original html (the purpose is unclear)
If you do pip install --user mobi
, you can easily unpack
kindlegen-made .mobi hamburgers as:
$ mobiunpack foo.mobi
then foo/mobi7
directory will be filled with the classics,
foo/mobi8
with KF8.
I attempted to sent such a bona file .mobi, but got the same achtung
email from Amazon.
A couple of years ago, Amazon deprecated Kindlegen in lieu of a fancy
Kindle Previewer application (no Linux version this time). Gone was
the simple CLI utility, an updated monstrosity required you to
manually drop your source files onto its window, jubilantly stare at
the result, click File
→Export
.
I diligently did that yesterday, expecting to find 'epub' option in
the export window, but there was none. I also tried in
vain to use a no less fancy Kindle Create suite, but it didn't allow
me to import html files, offering .docx, which was pretty useless.
I compared that .moby from Kindle Previewer with the .moby from the
abandoned Kindlegen-2.9 & found only minor differences at the level of
dc:identifier
in .opf files, i.e. no practical differences
whatsoever. It was the same 'hamburger' mobi! Looking in the
directory with the Kindle Previewer installation I stumbled upon
kindlegen.exe
executable, version 2.9 (yes), only instead of 2014
the copyright year was changed to 2015.
I understand they wrote a GUI wrapper on steroids, but forgot about
the underline converter. Maybe a guy who wrote the latter is no
longer works for Amazon, & the code is hairy.
Fine. So I concocted a hand-made epub generator--merely to see what
happens when I send an .epub to the Kindle cloud. (Before sending it
off, I made sure epubcheck utility gave me no errors.)
This time I got no warning emails, & something successfully made it to
Kindle. I connected the device via a cable to my Fedora machine to
extract the arrived file.
It wasn't an epub file, no, Kindles don't understand that (too
sophisticated data). It wasn't a classic mobi either, for it would've
been rather strange to downgrade modern html to such a limited
format. It was the file with .azw3 extension that contained only 1
layer: Amazon KF8.
Once again, after comparing this .azw3 with the KF8 layer from the
forsaken Kindlegen-2.9, I found only tiny differences in the
irrelevant metadata, hence I suspect the code from Kindlegen continues
to live on, but we are not allowed to use it locally.
You may say "what do you care, just send a single .html to
USER@kindle.com" , but what one
should do in case he has a collection of cross-linked html files (also
called a book sometimes)? Make an epub? With what? Kindle Previewer
spits a mere .mobi, that, according to the chilling emails, was not
going to be supported since the previous month. Yes, I know about
Calibre (practically, the only viable option) & pandoc, thank you
very much. I'm talking about the official Amazon way.
2022-10-01 upd: A week ago Amazon started to discourage sending
.mobi files in a different fashion: although it still accepts a plain old
mobi & converts it to an .azw, but in the process it replaces its
title with the source file name & its author with 'Unknown'.
2022-10-30 upd: They fixed the issue with 'author' ('title' is
still broken).
- Still no idea what has been the issue.
- You can make an orthodox mobi with
kindlegen -gen_ff_mobi7 …
, but Calibre reformats input better.
- Or maybe they don't
use Kindglegen, for the results of sending html
directly are quite poor: ⓐ .xhtml attachments are rejected;
ⓑ anticipated metadata for title/author is absent (a file name for
a title (very useful), "unknown" for an author; I guess to parse
<meta name="author" content="…" />
is to ask too much); ⓒ a
mangled encoding (utf8 → cp1252?), in spite of having <meta
charset="utf-8" />
in the file; ⓓ no TOC of any kind, but that is
expected.
Tags: ойті
Authors: ag