Back in the day, when Twitter was still Twitter, I always found it very cool to be able to post weather updates there, every hour, on the hour. But Elon killed that feature and tried to turn the platform into something it isn’t, and after that I just lost interest in Twitter.
Two other platforms that do old school Twitter things, are Mastodon and Bluesky.
I don’t know if someone else already did this too, but just for fun I decided to see if (with some help) I would be able to fabricate some PHP that would post weather updates to Mastodon and Bluesky.
So now I have two scripts, one for each platform. I have set two cron jobs, one for each script, to run the scripts every hour, and here we are.
Basically both scripts retrieve a WD wx##.html file, and then post its contents.
Mastodon allows for automated posting, they even have a checkbox for that so you can let followers know it is automated content.
I’m a bit hesitant about Bluesky though. I haven’t seen if they explicitly allow automated posting, but I also haven’t seen they explicitly forbid it.
//edit: I asked Bluesky support, they replied: it’s allowed.
Should anyone want to do the same, let me know, and I’ll send you the scripts. You will have to then implement it yourself on your own webserver though
I’m happy with the result:
//edit 2024-11-24…
I never expected this much attention for it, but since several people have asked, I have now added the original scripts to this post.
post-to-mastodon.zip (2.0 KB)
post-to-bluesky.zip (2.2 KB)
Do keep in mind that:
- There is 300 character limit for Bluesky which this script does not account for. So if you go over that, your content won’t get posted even though the script might say “success”.
- The scripts contain several, specific to my goal, text replace actions. You can of course change or remove those.
- I am not a programmer, and I have had some help left and right, so what we have here may look nasty to you if you are a programmer, so please bear with me. At least it posts
If you feel like upgrading/improving the scripts, be my guest of course, but please do post the results here in this thread
//extra edit…
As requested, this is the wxlocalXX.html source file Weather-Display enters values into, and uploads, and which the script then uses as a source for the posts.
Het weer in Hilversum van %date-year%-%date-month%-%date-day%, %time%u:
- Temperatuur: %temp%°C (%tempchangehour%)
- Rel. luchtv.: %hum%% (%humchangelasthour%)
- Dauwpunt: %dew%°C (%dewchangelasthour%)
- Luchtdruk: %baro% hPa (%barochangelasthour%)
- Wind: %avgspd% km/u %dirlabeldutch%
- Max. vlaag vorig uur: %maxgsthr%
- Regen vandaag: %dayrn%mm
- Zon: %VPsolar% W/m<sup>2</sup>
- UV: %VPuv%