How to use 'rss2bsky' to automatically post RSS feed contents to Bluesky



'rss2bsky' is a tool that automatically posts to Bluesky based on RSS feeds. I actually tried it out to see how easy it is to use.

nesges/rss2bsky: Post items of a RSS-Feed to Bluesky. Also contains a simple script to post a single skeet to Bluesky. Written in PHP - Codeberg.org

https://codeberg.org/nesges/rss2bsky

In order to run rss2bsky, you will need ``SQLite3, CURL, SimpleXML, GD, PHP that supports multibyte characters'' and ``SimplePie'' in addition to a Bluesky account. This time, in order to run it on Ubuntu, I entered the following command to install the necessary tools.
[code]sudo apt install php-sqlite3 php-curl php-xml php-mbstring php-gd libphp-simplepie[/code]



Once the tool is ready, download rss2bsky using the command below.
[code]git clone https://codeberg.org/nesges/rss2bsky.git
cd rss2bsky[/code]



Then, create a 'cache' directory and give ownership to the server user such as 'www-data'.
[code]mkdir cache
sudo chown www-data.www-data cache[/code]



Next, create a 'lib' directory and copy the SimplePie code.
[code]mkdir lib
cp /usr/share/php/simplepie/SimplePie.compiled.php lib/SimplePie.compiled.php[/code]



We will also obtain the information necessary to log in to Bluesky. Log in to Bluesky and click 'App password' in settings.



Click Add App Password.



Give it a name so you know what the password is used for, and click 'Create app password'.



The password will be displayed, so just copy it and you're ready.



Copy and rename 'config.sample.php' to 'config.php' and open it in a text editor.
[code]cp config.sample.php config.php
vi config.php[/code]



The following parts need to be changed. In 'feed-url', specify the URL of the RSS feed that will be the source of the post, and in 'bluesky-username' enter the Bluesky user name. Enter the app password you copied earlier in 'bluesky-password' and specify 'ja-JP' in 'bluesky-language'. In the last 'cache-dir', enter the absolute path of the 'cache' folder you created earlier.



After saving your changes and closing the editor, start rss2bsky with the command below.
[code]/usr/bin/php rss2bsky.php[/code]



However, the error 'PHP Fatal error: Uncaught Exception: Unable to open database: bad parameter or other API misuse in~' appeared and the operation stopped. It seems that the problem is that the cache folder does not have write permission, so enter the following command.
[code]sudo chmod a+w cache[/code]



When I ran it again, the contents of the feed were displayed, and the message 'posted' was displayed.



When you check the Bluesky screen, the contents of the RSS feed are successfully posted.



Even if the same RSS feed was used continuously, the message 'already posted .. skipped' was displayed and continuous posting was prevented.



Therefore, by configuring cron as shown below, it will post according to RSS updates.
[code]0 * * * * /usr/bin/php /opt/rss2bsky/rss2bsky.php > /dev/null[/code]



Please note that rss2bsky also comes with a script for simple manual posting, which can be used with the command below.
[code]./post 'Testing manual posting!'[/code]



Even in the case of manual posting, I was able to confirm that it was posted properly.

in Review,   Software,   Web Application, Posted by log1d_ts