Creating Your Own Kindle Newspaper

6 Sep 2020

One of the interesting features of Kindle is the ability to subscribe to newspapers or magazines and get them delivered to your Kindle when a new issue is released. This works great for publications that are sold on the Kindle store, but what about your subscribed RSS feeds? I wanted to see if it was possible to create a daily ‘newspaper’, containing all of my RSS aggregator’s unread articles and a weekly ‘magazine’ of unread items I’d saved to Pocket.

Things you’ll need:

  • Some RSS feeds to read. Either published from your own aggregator or a collection of individual feeds.
  • A server somewhere. You don’t need much power, a free F1-micro in Google Cloud should do it (I am using a $5/month Linode server).
  • Calibre, for creating the ebook.
  • A Sendgrid account for sending emails to your Kindle.

Feeds

I have two main feeds I am using, one to build the ‘newspaper’ and another to build the ‘magazine’.

Newspaper

My FreshRSS instance publishes an aggregated feed of all of my RSS subscriptions. This feed also allows you to use query parameters to filter what is returned. I use:

  • state=2 to only get unread articles.
  • get=c_n where n is a category id. To get articles from a specific category (I use this to break the ‘newspaper’ into different sections).

Magazine

For the ‘magazine’ I’m using my Pocket account’s RSS feed, which contains unread items I’ve saved to Pocket. This lets me save interesting things during the week and I can get them all together in one issue on the weekend to read.

Calibre

Calibre is an open source tool for managing your ebook library. It actually has the perfect feature, the ability to download RSS feeds and package them into an ebook. In fact, you can do everything in this post just using Calibre and a Sendgrid account. However, you need to have Calibre open for scheduling to work or run the full suite on a server somewhere.

Luckily, Calibre provides a bunch of command line tools that actually power what it’s doing behind the UI. In our case, ebook-convert is what we can use to download RSS feeds and output an ebook. This tool takes a .recipe file (its a .py file with a different name), handles all of the feed downloading and parsing and packages it up into the right output format. A recipe file looks something like this:

...
class MyNewRecipe(BasicNewsRecipe):
    feeds = [
        "feed.com/feed.rss"
    ]
...

There’s a lot more options you can specify, here’s some of my favourites:

# Give the cover a random picture each time
cover_url = "https://source.unsplash.com/random/600x800"
# Make the title on Kindle include the date
custom_title = "Newspaper - " + time.strftime('%d %b %Y')
# Fix feeds that use UTF-8 chars
encoding = "utf8"

You can find more options here. You can get super complicated and fancy with styling and article parsing using different function hooks in your recipe class. Calibre also has plenty of built-in recipes for popular sites.

Once you have your recipe file ready, you can create an ebook from it by running the following (outputting mobi here as that’s what Kindle will accept via email):

ebook-convert myrecipe.recipe myrecipe.mobi

All you have to do is run this in a cron job whenever you want to produce a new issue of your ‘newspaper’ and it’s all created for you. The next step is delivering this to your Kindle.

Sendgrid

I chose Sendgrid for this because frankly, it was the first thing I thought of and it lets you send 100 emails a day with a free plan. Plenty for sending stuff to your Kindle. You could, however, use whatever email service you want. I was limited by the fact that Linode blocks sending email by default, so the Send Grid Web API made things a lot easier.

I could probably go into a lot of detail here about how this works for me, but at the end of the day it’s just using the send to Kindle service. I was limited by the fact my server is on Alpine (for reasons) and Linode’s email policy so I ended up creating a Docker image that scoops up files and emails them. If you’re interested in this monstrosity, you can see the source here.

Putting it all together

The final part is just setting up a job on your server to run the ebook-convert command and whatever email sending method you’ve chosen that sends it out. Make sure you allow your email sender to send documents to Kindle and you’re ready to go. The finished article(s):