A lot of people migrates from Twitter to the decentralized an free Mastodon social network and it’s a great thing. You would like to offer great content on Mastodon from your RSS feeds, maybe the new post of your own blog? Just use the new Feed2toot bot!
Feed2toot is a powerful RSS to Mastodon bot with lots of great features like:
- manage multiple RSS feeds
- pattern matching to select entries from the RSS feeds
- smart management of hashtags from the RSS feeds
Advertise your own blog posts on Mastodon
Let’s say you have a great blog and you would like to automatically inform your Mastodon followers about your new blog post.
Start by installing Feed2toot:
# pip3 install feed2toot
We are going to create a dedicated user on your system, a dedicated directory in /etc and /var/lib to store Feed2toot configuration and data:
# adduser --home /var/lib/feed2toot --gecos "" feed2toot # mkdir -p /etc/feed2toot/credentials /var/lib/feed2toot # chown -R feed2toot:root /etc/feed2toot /var/lib/feed2toot
Lets generate an app to authorize this app use our account. It’s a really simple process with the following command:
$ register_feed2toot_app
Just answer the questions and the files feed2toot_usercred.txt and feed2toot_clientcred.txt will be created in your current work directory.
We now write the following configuration in the file /etc/feed2toot/feed2toot.ini:
[mastodon] instance_url=https://mastodon.social user_credentials=/etc/feed2toot/credentials/feed2toot_usercred.txt client_credentials=/etc/feed2toot/credentials/feed2toot_clientcred.txt [cache] cachefile=/var/lib/feed2toot/feed2toot.db [rss] uri=https:/carlchenet.com/feed tweet={title} {link} [hashtaglist] several_words_hashtags_list=/etc/feed2toot/hashtags.txt
Ok our Feed2toot configuration is ready. If you want to avoid sending all the RSS entries to Mastodon, because maybe you did it manually before, use the following command to populate the Feed2toot cache:
$ feed2toot --populate-cache -c /etc/feed2toot/feed2toot.ini
We are now all set. Just use the following command each time you want to send new RSS entries of your feed:
$ feed2toot -c /etc/feed2toot/feed2toot.ini
It’s more convenient to have a line in your /etc/crontab file in order to not perform manually the previous task. We want automatize all things!
*/30 * * * * feed2toot feed2toot -c /etc/feed2toot/feed2toot.ini
More information about Feed2toot
- Feed2toot on Gitlab.com (would be awesome starring it if you like/use it)
- The official documentation on Readthedocs.io
… and finally
You can help the Feed2toot Bot by donating anything through Liberaypay (also possible with cryptocurrencies). That’s a big factor motivation 😉
Thanks, I managed to get this working op an OpenSUSE system with two workarounds:
1) had to use useradd command since adduser command is not known in OpenSUSE and several other linux flavours
2) had to delete the –gecos “” part since that is also not known in OpenSUSE linux.
By changing the first and just deleting the 2nd this worked for me on my OpenSUSE system.
I tested with an RSS feed fetched from Twitter (to post a tweet via RSS to Mastodon as a toot) which learned me that when you have a % in your RSS URI then you should type a second % in your feed2toot.ini right after it (so % should be –> %%) to prevent ending up with a parsing error message by feed2toot.
Thanks for your blogpost.
I also went to the full documentation for additional info:
https://feed2toot.readthedocs.io/en/latest/use.html#how-to-display-available-sections-of-the-rss-feed
so:
[code]
# useradd –home /var/lib/feed2toot feed2toot
# mkdir -p /etc/feed2toot /var/lib/feed2toot
# chown -R feed2toot:root /etc/feed2toot /var/lib/feed2toot
[/code]
in Open SUSE
Michiel: Thanks for your great feedback!
Sorry for the previous comment, it turned out a false positive issue.
So, yep, as I suspected it was a Windows10 built-in SSH client issue
Thanks for the tips!
Testing in my raspberry pi with openSUSE Tumbleweed (JeOS)…
‘ve phun!
Hello!
I installed this in my Pi with Tumbleweed with no issues.
But recently I changed openSUSE and installed Raspbian, and now I can’t run this useful script.
When I run register_feed2toot_app I get and error:
http://susepaste.org/73160767
Greetings
Dear all,
for a newbie like me, this how-to lacks this info
– after :
Just answer the questions and the files feed2toot_usercred.txt and feed2toot_clientcred.txt will be created in your current work directory.
i think it could be nice to add :
than move the two files to /etc/feed2toot/credentials folder.
Thanks otherwise !
I really want to utilize something like this, there are wordpress plugins but they seem to only allow one single Mastodon profile.
I have multiple I’d like to post to, is there step by step for a complete beginner to give this a go?
Just use this step-by-step guide with multiple .ini files. One for each Mastodon account.