CLI for Readlist

I maintain the readlist in a CouchDB database. Each feed (channel) is a document in that database. I use the file's name as the primary key i.e "_id". For example, "sri-lankas-economic-crisis.json" is the key to the Sri Lankan Economic Crisis reading list. It's a single document. It has many feed items like any JSONFeed. The first few were easy to create and manage. But then I needed something simple to manage this if I was going to be serious about using it. So I borrowed the idea from BBRF client and created a simple CLI client that I can use.

Given a config file. Readlist CLI can be used to create a Channel, and add items to a channel. That's it. I have not added destructive actions to the CLI. I do it manually, as I don't do that often. 

{
    "couchdb": "https://courchdb-url.com/readlists",
    "username": "couchdb_user",
    "password": "couchdb_password",
    "channel": "current_channel.json",
    "author":
    {
        "name": "Thejesh GN",
        "url": "https://thejeshgn.com"
    },
    "home_page_url": "https://thejeshgn.com",
    "feed_base_url": "https://example.cdn.com/readlists/{0}",
    "debug": true
}

While adding the URL to an existing Channel, it will try and pull the entire content if "-f" flag is passed. Else it will add the minimum content required to form the JSONFeed item. 

Readlist Client

Usage:
  readlist get
  readlist use <channel>
  readlist new -c <channel> -t <title> -d <description>
  readlist [-c <channel>] [-f] add <url> 

Options:
  -h --help            Show this screen.
  -v --version         Version of this program
  -c <channel>         Select a channel to limit the command to. Not required when the command "use" has been run before.

I use trafilatura to scrape the articles and get the details, requests to talk to CouchDB and docopt to create the command-line interface.

it's not fully tested, and I have not written test cases yet. But I have been using it for a while now. Use it at your risk. 

It also needs a CouchDB. CLI provides the input side of the feed. On the output side, you can use a serverless function to read the document corresponding to a channel or readlist from CouchDB and serve it. Since the Document is a valid JSONFeed, you don't need to do any transformation before serving. It can be cached easily and can be served using a CDN.

You can install it from

https://github.com/thejeshgn/readlist


You can read this blog using RSS Feed. But if you are the person who loves getting emails, then you can join my readers by signing up.

Join 2,238 other subscribers

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.