Kindle is now supported by url2epub
Background
url2epub is a Go open source project I did after I bought a reMarkable 2, as my way to easily send webpages to it to read later.
It uses reMarkable cloud, which does not really have a documented public API. There are communities of developers who reverse engineered the API, which is what my code is based on.
The API had breaking changes a few times over the years, which would break my code until someone figured out the new API and I implemented it. Recently it’s broken again, but this time it’s not really API.
Except for the first few months of 2020⁄2021, it actually never worked out of the box. On the reMarkable e-ink device, it requires a few extra files besides the ePub file to work. There’s a metadata file, and a few other files storing the page and rendering data. The metadata file is easy to fill, but the other files are not, so my code just skips them/fills them with some placeholder content, and it kinda works. For the first few months, it works perfectly. After that the e-ink device will not show those files after synced them from the cloud because they don’t have all the other files correctly, but a workaround is that the mobile app, after synced the file from the cloud, will auto “fix” those files (by generating them), and re-sync the fixed version to the cloud, and then the e-ink device will be happy to show them.
Until recently, the mobile app stops showing and fixing those files, and url2epub is basically totally broken for reMarkable cloud.
Switching to Kindle
Recently my wife bought a new Boox e-ink device to replace her old Kindle Oasis, so I inherited the Kindle. Since Kindles support Send to Kindle by email, I thought it would make sense to tweak url2epub to also support sending kindle emails, besides uploading them to reMarkable cloud.
I have a free mailgun account for my old blog systems to send notification emails, so I looked up mailgun’s API documentation, and found it easy enough, and took today to implement it in url2epub.
It did take me some time to make those ePub files to actually show up on the Kindle. At first I didn’t realize that I need to allowlist the from address in my account to accept it (Amazon did send an email to my Amazon account email to tell me that, but I didn’t check email for a while when debugging that). After that it still didn’t work, and I didn’t have any clue until I changed the from address to an email address that I can actually receive emails, to see that Amazon told me (the from address, not my Amazon account email address) that “could not be delivered to the address you specified” without any more details. After a while I started to suspect that it’s their ePub parser don’t like the ePub file I generated, and started to look into ePub documentation, and fixed some compliance issues, and then it finally worked. I do not know exactly which part of the ePub Amazon does not like, but I think it’s highly likely that I used to skip the nav
file in the ePub. This commit is what I did to improve the compliance of the ePub files I generated.
The mailgun API part is mostly in mg.go
file, if anyone is curious. I used only go’s standard library instead of mailgun’s official go library, because their go library can only attach files from filesystem, instead of from memory.
The Telegram bot, which is still named url2rM_bot
, used to accept the /start
command in the format of /start <8-digit reMarkable connect code>
to link your reMarkable account. Now it split that into 2 different ways:
/start rm <8-digit reMarkable connect code>
for reMarkable, which is currently broken/start kindle <send-to-kindle email address>
for Kindle, which is currently experimental
I’m also open to add support to other e-ink platforms as long as they have a reasonable way to send ePub files to the device remotely (either some cloud API or email or something). If you have something to suggest, please get in touch (either use the comment system below, or via the project’s gitter chat, both are powered by [matrix]
).
So if you have a Kindle and want to send some webpages to it to read later, welcome to try it. A few tips regarding using it with Kindle:
- Remember to allowlist the email address I used in the bot.
- I also disabled the “Personal Document Archiving” feature, which is at the same place to allowlist email address, so that those files only show up in the Kindle device without being stored in my account.