💾 Archived View for gmi.bacardi55.io › blog › 2024 › 01 › 10 › creating-my-blog-bot-with-feed2fedi captured on 2024-06-16 at 12:50:28. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-02-05)
-=-=-=-=-=-=-
Posted on 2024-01-10
Yesterday, I [wrote about my recent change in using the fediverse]. One of them being a new [blog BOT account] that toot a new message for each new blog entry like this one. The goal of this post is to describe how it works.
To do this, I'm using [Feed2fedi], a simple tool that takes RSS feeds as input and post a toot for each new article (using a sqlite cache to avoid duplication). This tool worked perfectly with GoToSocial :). To install Feed2fedi, you can either build the source or simply use pipx. On debian:
$ pipx ensurepath
$ pipx install feed2fedi
Once installed, you need to run it to configure. Use the `-c' option to specify where to save the config file. In my case:
~/.local/bin/feed2fedi -c ~/.config/feed2fedi/blog-config.json
Then follow the wizard by giving the instance URL and the token generated on the linked provided by the command line.
Once done, edit the generated configuration file to add your RSS feed(s) URL(s). Multiple URLs can be added, but in my case this BOT is only for my blog so only 1 URL was needed. My configuration file looks like this:
{ "feeds": [ { "url": "https://bacardi55.io/posts/index.xml", "prefix": "[New Blog Post]", "max_attachments": "max" } ], "fedi_instance": "https://social.bacardi55.io", "fedi_access_token": "<redacted>", "cache_max_age": 30, "cache_db_path": "~/.config/feed2fedi/cache-blog.sqlite", "bot_post_media": false, "bot_post_visibility": "public", "bot_post_template": "{title}\\n\\n{link}" }
Read the [configuration file explaination] to understand more the config above.
Now that this is done, running feed2fedi should import the latest posts to the connected account, simply by running:
~/.local/bin/feed2fedi -c /home/<user>/.config/feed2fedi/blog-config.json
Last task is to automate the start of feed2fedi via a cron task. To do so, launch `crontab -e' and add:
55 * * * * /home/<user>/.local/bin/feed2fedi -c /home/<user>/.config/feed2fedi/blog-config.json >> /home/<user>/.config/feed2fedi/blog.log
Of course, adapt to your needs / configuration.
Next time, I'll talk about the [links BOT] that was a bit more complicated due to the lack of RSS feeds for public shared links on linkding… But nothing RSS Bridge couldn't fixed!
wrote about my recent change in using the fediverse