A scheduled Val that watches the YouTube channel @kairicaitlyn for new uploads and posts an embed to your Discord webhook.
Every 15 minutes the val:
- Resolves the channel ID from the YouTube handle page (
@kairicaitlyn). - Fetches the channel's RSS feed (
feeds/videos.xml?channel_id=β¦). - Posts any new short or regular video as a Discord embed (title, link, thumbnail, playable video player).
- Remembers already-seen video IDs in val-scoped blob storage, so nothing is posted twice.
Livestreams are filtered out β only shorts and regular uploads are posted. Detection uses the RSS description (livestream VODs on this channel carry a "Broadcasted live on Twitch" line). The manual-send endpoint can still post any video you explicitly choose.
First run is a "seed" run: it records all currently-published videos and posts nothing, so you only get notified about uploads from now on, not the back-catalogue.
The Discord webhook URL is stored as an environment variable DISCORD_WEBHOOK_URL (already set). If you ever need to change the target:
π Add DISCORD_WEBHOOK_URL here: https://www.val.town/x/rogueyoshi/youtube-rss-to-discord/environment-variables?key=DISCORD_WEBHOOK_URL
The interval currently runs every 15 minutes (the minimum for free tier). To watch a different channel, change CHANNEL_HANDLE in main.ts.
There's an HTTP endpoint for testing and for manually posting videos the cron may have missed. It's protected by an API_TOKEN β every request must supply it as a ?token= query param, an Authorization: Bearer <token> header, or a token field in a JSON body.
Your token: 9Xq2mRpvZ7KtH4sW8eNb3cLx6fD1gY5a
- Form (browser): https://kairi-youtube-discord.val.run/?token=9Xq2mRpvZ7KtH4sW8eNb3cLx6fD1gY5a β includes a dropdown of recent shorts & regular uploads to pick from, plus a free-text field for any URL. The dropdown pulls from the channel's Videos + Shorts tabs (the RSS feed only exposes ~15 newest entries, which can all be streams), and skips livestreams.
- List recent uploads:
GET /?token=β¦&action=listreturns JSON of up to 15 non-livestream uploads. - Send one:
POST /with a JSON body:
curl -X POST https://kairi-youtube-discord.val.run/ \ -H "Authorization: Bearer 9Xq2mRpvZ7KtH4sW8eNb3cLx6fD1gY5a" \ -H "Content-Type: application/json" \ -d '{"videoUrl":"https://youtu.be/VIDEOID"}'
It accepts a full YouTube URL (youtube.com/watch?v=β¦, youtu.be/β¦, shorts/β¦) or a bare 11-char video ID. Every post is a playable video embed (Discord renders an in-line player).
By default the sent video is added to the "seen" set so the cron won't re-post it. Pass ?markSeen=0 (or "markSeen": false in the JSON body) to send without marking it.
π Keep
API_TOKENsecret β anyone holding it can post to your Discord webhook.