Skip to content

About

Devvit App to fetch the latest episdode from youtube, generate a post via Gemini, and pin it to subreddit.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

68 Commits

Folders and files

Repository files navigation

YouTube + Gemini Post Devvit App

A Devvit app that monitors a YouTube playlist for new videos, generates a Reddit post using the Google Gemini API, and manages pin rotation on the subreddit. Both APIs are free-tier, making this a zero-cost automation for any community.

Demo: https://www.youtube.com/watch?v=Xdm_pJxI6Yo

You can use the YouTube + Gemini Post Companion Site to validate your API key and test different prompts.

Issues & Requests: HeyItsGilbert/YouTubeGeminiPostDevvit

What it does

  • Monitors a YouTube playlist every 30 minutes via a scheduled job
  • Detects new videos using a per-video Redis registry to track every seen video
  • Calls Gemini with video metadata and a mod-supplied system prompt to generate a discussion post
  • Submits a link post pointing directly at the video — gets Reddit's native thumbnail preview card — and posts the generated discussion text as a distinguished, stickied top comment
  • Rotates the pin — pins the new post and unpins the previous one
  • Notifies the triggering mod by PM if a manually triggered action fails
  • Optional mod approval gate — hold generated posts for review before publishing, with an optional auto-approve timer

Moderators get three items in the subreddit's "…" menu (next to Mod Tools):

  • Configure bot — set the Google API key and which sticky slot (1 or 2) episode posts take. Under Advanced (optional) you can override the Gemini model (default: Gemini Flash Latest) and thinking level (default: the model decides); most subreddits should leave these alone.
  • Check for new videos — run a check immediately.
  • Review pending post — when mod approval is enabled, edit the pending post, then publish it, discard it (the next check treats the video as unseen), or reject the video (never post it).

On any episode post, the post menu offers Regenerate discussion: rewrite the discussion comment with fresh Gemini output, optionally with a different model, thinking level, or edited system prompt for that one regeneration. If any manual action fails, the triggering mod receives a Reddit PM with the error details. Scheduled (cron) runs are self-healing — state is only persisted on success, so the next 30-minute tick retries automatically.

API Key

  1. Navigate to your subreddit.
  2. Open the subreddit's "…" menu and select Configure bot.
  3. Paste your key into the Google API Key field and click Save. Leave it blank later to keep the saved key while changing the pin slot.

The key is stored in the subreddit's Redis store. To get a key, visit the visit the AI Studio, create a project and API key. Then go to Google Cloud Console, switch to the new project, and enable both the YouTube Data API v3.

Settings

All settings are configured per subreddit in the app's installation settings.

Name Type Secret Default Description
youtubePlaylistId string No -- YouTube playlist ID to monitor
excludeTitleKeywords string No (empty) Comma-separated keywords. Videos whose titles contain any keyword are permanently skipped (e.g. trailer, short, bonus)
systemPrompt paragraph No -- System prompt for Gemini. User message includes Title, Published, Link, and Description
botFlairEmoji string No (empty) Emoji for the bot's author flair on this subreddit, e.g. 🎙️
botFlairText string No (empty) Text for the bot's author flair, e.g. Podcast Bot. Combined with emoji if both are set
prependText paragraph No (empty) Text prepended to every generated post body (e.g. recurring links, disclaimers)
appendText paragraph No (empty) Text appended to every generated post body (e.g. footers, recurring links)
flairName string No (empty) Post flair to apply (exact name match, optional)
notificationMods string No (empty) Comma-separated Reddit usernames to notify when a post is queued (e.g. alice, bob). Falls back to mod inbox when blank
requireModApproval boolean No false When enabled, generated posts are queued for mod review instead of posting immediately
autoApproveWindowMinutes number No 0 Minutes before auto-publishing a queued post if no mod acts. 0 = indefinite hold. Only applies when mod approval is enabled

Developers

See the Developer docs on the GitHub.

About

Devvit App to fetch the latest episdode from youtube, generate a post via Gemini, and pin it to subreddit.

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages