This is a tool that posts a link to a Telegram chat when Tsoding uploads.
To build with Nix, run nix build
. result/bin/tsoping
will contain the script.
Dependencies can be seen in the flake.nix file.
tsoping run
This program expects two files to be present in the current directory:
-
data/chat.id
-- the id of the chat where to send the link. The bot has to be added to this chat. -
data/telegram.secret
-- the bot's secret token provided by BotFather.
The following command line may be helpful to discover the id of the chat to which the bot has been added:
curl "https://api.telegram.org/bot$(cat secret)/getUpdates" | jq
The program has a couple of different modes, which may be helpful for debugging. They are indicated by the first argument to the program.
-
fetch
: fetches the feed, converts it to JSON and saves it todata/videos.json
. -
set-start-time
: setsdata/last.time
with the current system time. You may want to set the time manually. -
set-chat-id
: saves the chat id given as an argument todata/chat.id
(this is just an echo at the time of writing). -
links
: does all of the above if needed, but also filters out only new videos and saves them tolinks.txt
. -
send-to-telegram
: sends one link to the Telegram chat and updates the time indata/last.time
. -
Run: sends all not yet sent links since the recorded time to the Telegram chat.
MIT.