Nexcloud News app feeds on e-reader

Опубликовано: 05 Октябрь 2024
на канале: Solve Computer Science
154
1

Want to read your RSS feeds offline on an e-ink display? You can do it by using the Nextcloud News app and its API.

We all know that using an e-ink display such as the ones offered by most e-readers is less taxing on your eyes. So why not use these devices to read news updates instead of books exclusively? The Nexcloud news app API offers a simple interface to get all the news feeds as JSON objects. The `body` attribute of this object is pure HTML. Other important attributes are: `pubDate`, `author` and `url`. Once you get these fields you can build an HTML file. The script I show you in this video builds one HTML file per feed. Once all HTML files have been saved in a cache directory they are converted to a single epub file using Pandoc. What you get in the end is a single "book" with all the news feeds.

The user can configure the number of feeds to be downloaded for each source, as well as to mark these feeds as read or starred.

Since the HTML output is not sanitized by Nextcloud, the script uses the nh3 library to clean the HTML before it is fed to Pandoc.

Enjoy :)

Links:

_ Nextcloud news app: https://apps.nextcloud.com/apps/news
Script, configuration, Makefile, etc...: https://docs.franco.net.eu.org/ftutor...
Pandoc: https://pandoc.org/

CHAPTERS

0:00 Intro
0:59 The `get_sources` and `get_feeds` functions in the script: peaking the Nextcloud news app API v1.3
3:07 The `build_html` function: creating the content of a single HTML file starting from data gathered by the Nextcloud API
4:48 The `post_actions` function: marking the feeds as read or starred
5:54 The `main` function: cache directory, iteration on each source to get the feeds, html generation and sanitization, html files to single epub files with pandoc, and post actions
8:53 The configuration file
10:03 Setting up the Python environment
11:01 Generating the app password from Nextcloud to be used by the script and updating the configuration
11:31 Running the script
11:45 Checking the epub file
12:41 Having a look at the cached HTML files
13:30 Outro

#nextcloud #ebook #rss #epub #solvecomputerscience