Get Your RSS Feeds To Mastodon With The Feed2toot bot

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

mastodon

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

… and finally

You can help the Feed2toot Bot by donating anything through Liberaypay (also possible with cryptocurrencies). That’s a big factor motivation 😉

10 thoughts on “Get Your RSS Feeds To Mastodon With The Feed2toot bot

  1. 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

  2. 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

  3. 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

  4. 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 !

  5. 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?

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *