When I came to #Mastodon I directly engaged with the bot possibilities, and so I started my own RSS feed bridge to publish in the #fediverse. This is around a year and a half ago.
Since then, my EchoBot evolved quite a lot in stability and functionalities, but moved a bit away from the initial idea of having a personal companion that pings me when new content has published.
Recently I took its last version, stripped out everything not meant to be in a RSS feed reader, and added mentions interaction, to give birth to a new bot: the Masto-Feed.
Today I just finished the last details after seeing it working nice for the last month, and I am proud to present it to you in this blog post.
Masto-Feed | RSS feed reader that posts updates in Mastodon API |
---|
Because.
In my case I wanted a bot that I can deploy to an account and bridge content. EchoBot does an excellent job bringing content from RSS feeds and Telegram channels as can be seen in the Ajuntament de Talamanca bot, the Regional news bot and the Ràdio bot.
While the run is smooth and elegant, the maintenance is a bit cumbersome as it reads from a config file. For static accounts this is fine (they don’t update the sources often) but for a more personal RSS reader it is really not ideal, as one needs to ssh into the host and update the config for any new addition.
And this is actually the birth of the new Masto-Feed bot: including a listener for the mentions so that I can interact with it adding and updating sources on the go.
Yes, that’s the idea.
To simplify the concept, the bot understands a set of instructions and reacts on them. This way I can directly tell him to add a new source, change it or remove it, list me the sources I have or show me the available commands.
He’s even polite enough to say “Hi” when anyone mentions him without a direct command.
So at this point there is an instance of the bot at my nerdy Mastodon instance. Visiting its timeline you will see that he’s publishing the content that comes from the RSS feed sources that he’s currently monitoring. And this is the account I follow then.
Using your own Fediverse account, ask him directly to list the sources he has registered:
@feeder@social.arnaus.net list
...and he’ll answer with a list of URLs and their feeds.
Tell him “hello” and he’ll answer with a welcome message:
@feeder@social.arnaus.net hello
In this first version, he understands the basics to add, update list and remove feed sources. Please visit the Commands reference page in GitHub to get to know them better, but let me enumerate them here:
This command is an initial help command that explains itself and enumerates the available commands.
This command lists the feeds currently registered.
This command tests a given Site URL, by running all validations and trying to find the Feed URL (RSS, Atom, ...) that will be used to gather the content.
This command adds a given Site URL into the records, so the content will be gathered and processed.
This command updates an existing record's parameters. The only parameter that can't be changed is the alias
, at it works as ID. All given values will overwrite the previous ones.
This command deletes an existing record.
This is a Mastodon bot. The very first step is to have an account in any Mastodon server for it. Then you’ll need a host anywhere to clone the repository, install the Python dependencies, run the listener and add the main program into the host's crontab
.
I’ve detailed all the steps in the main README
file of the GitHub repository, so it should be easy.
First of all, this is a Python 3.9 app managed with Poetry. The readme explains how to install it from scratch.
It has 2 main entry points, one for the main application running scheduled that reads the configuration, gets the possible content from the sources, feeds a queue and publishes according to the setup, and another that stays running in the background listening the streaming Mastodon endpoint for mentions to the account, and it’s responsible for applying the direct actions and answers.
The whole application runs without databases, only file based using Yaml files as storage. The configuration files are over-commented intending to make really easy to maintain.
Some of the functionalities that I am proud of are:
bin/mastofeed commands
to see the available commandsTake a look at the README
of the repository to get to know them!
The bot is now in its debut version v0.0.1
. I am sure that it will evolve, receive fixes and new features. Let me know if you use it, and ask me anything about the installation or the running, or for any feedback you may have: I’m always at @xavi@social.arnaus.net
Masto-Feed | RSS feed reader that posts updates in Mastodon API |
---|