blog2kindle is a little Python script that can turn RSS feeds of your favourite websites (e.g. blogs, news articles) into ebooks which can be read on ebook readers, such as Kindle, Apple Books.
It's based on code from news2kindle which reads a list of RSS feeds, package them as a MOBI file, and then send it to your kindle via kindle mail address and Amazon's whispersync.
Demo: ebook for blog Coding Horror
- Python 3.8.20 (recommend install with pyenv)
Calibre which provides 'ebook-convert' command (no longer necessary as Amazon now accpets sending ePub instead of Mobi files)
python3 ./src/news2kindle.py [blog title] [slice number]
You can use blog_crawler to crawl any website and generate RSS feeds from them. See how it works here.
2. Publish the generated RSS feeds online (as news2kindle reads content of RSS feeds from a list of URLs)
For example, you can publish the RSS feed to a Github repo (like this one):
git add ./out # folder with RSS feeds slice-[0-9].xml
git commit -m "publish blog feeds"
git push origin master # publish the RSS file somewhere online to get a public URL
Not to be confused of slice-[0-9].xml, which are actual files with RSS feeds content, where as slice-[0-9].txt consists of only links to slices-[0-9].xml files. slice-[0-9].txt is equivalent to feeds.txt, output of blog_crawler's "render" command, like this feeds.txt.
See examples of slice-[0-9].txt files here.
export $(cat .env | xargs)
python3 ./src/news2kindle.py "blog title" 0 # which fetches the content of each RSS feeds linked in config/slice-0.txt, package them as a MOBI file, and then send it to your kindle via kindle mail address and Amazon's whispersync.
To generate multiple books in batch, you can run:
for i in {0..9}
do
echo "https://raw.githubusercontent.com/goooooouwa/rss-feeds/master/codinghorror/slice-$i.xml" > config/slice-$i.txt
python3 ./src/news2kindle.py "blog title" $i
done
Now you will have your favourite blog sent to your Kindle, waiting for you to pick up.