[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-94793":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":9,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":16,"hasPages":16,"topics":18,"createdAt":9,"pushedAt":9,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":14,"starSnapshotCount":14,"syncStatus":42,"lastSyncTime":9,"discoverSource":43},94793,"youtube-automation-agent","darkzOGx\u002Fyoutube-automation-agent","darkzOGx","🎬 Fully automated YouTube channel management with AI agents. Creates, optimizes & publishes videos 24\u002F7. Works with FREE Gemini API or OpenAI. No coding required!",null,"https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fyoutube-automation-agent","JavaScript",2006,504,0,57.11,false,"main",[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"ai-agents","ai-powered","automation","content-automation","content-creation","content-strategy","free-tool","google-gemini","javascript","nodejs","openai","seo-optimization","social-media-automation","thumbnail-generator","video-generation","youtube-api","youtube-automation","youtube-bot","youtube-channel","youtube-uploader","2026-08-24 04:01:22","# YouTube Automation Agent\n\n## What's New in v2.4\n\n- **Guided walkthrough for first-time setup** — `npm run walkthrough` (also offered when you run `npm run setup`). It explains every choice in plain English, shows exactly where to get each key (and opens the page in your browser), **live-tests keys the moment you paste them**, walks you click-by-click through Google Cloud for the YouTube connection, and signs you in via your browser instead of copy-pasting auth codes. Every step is skippable and progress is saved — re-run it any time.\n- **`.env` files actually work now** — `dotenv` was a dependency but was never loaded, so `.env` settings (API keys, `API_KEY`, `FFMPEG_PATH`…) were silently ignored unless exported in your shell. `index.js` and the setup tools now load `.env` on start.\n- **`.env.example` no longer poisons setup** — the uncommented `OPENAI_API_KEY=your-openai-api-key-here` placeholder would have been picked up as a real key; all placeholders are now commented out.\n- **Browser OAuth opens automatically** — the YouTube authorization URL now opens in your default browser.\n\n## What's New in v2.3\n\n- **Full free-tier pipeline with Gemini** — image generation (`gemini-3.1-flash-image`) and native voice narration (`gemini-3.1-flash-tts-preview`) now run on your Gemini key. A Gemini-only setup produces complete narrated videos end to end; OpenAI\u002FElevenLabs are used first when configured. Models and voice are configurable via `GEMINI_IMAGE_MODEL`, `GEMINI_TTS_MODEL`, `GEMINI_TTS_VOICE`. (Thanks to PR #6 for demonstrating the demand and fallback-chain direction.)\n- **~50× faster slideshow rendering** — instead of screenshotting a headless browser at 30fps (~10 minutes for a 30-second video), the renderer captures one still per slide and lets FFmpeg build the video with crossfades (seconds).\n- **No more junk template topics** — template mode (no AI key) previously scraped single keywords from trending titles and produced videos like \"crown: The Complete Guide\". It now uses a curated evergreen topic list and only accepts trending topics that read like real subjects.\n- **Model catalog corrections** — replaced the nonexistent `gemini-3.5-pro` picker entry with `gemini-3.1-pro-preview` \u002F `gemini-2.5-pro` (verified against Google's current model list).\n\n## What's New in v2.2\n\nThis release resolves every open GitHub issue (#1, #2, #3, #4, #8, #9, #13):\n\n- **Gemini (and every other provider) now passes credential validation** — startup and setup no longer demand an OpenAI key. Any one configured AI provider (OpenAI, Gemini, OpenRouter, Kimi, MiMo, or GLM) is enough. (#3, #9)\n- **FFmpeg is bundled** — `npm install` now pulls a prebuilt FFmpeg binary via `ffmpeg-static`, so `'ffmpeg' is not recognized` is gone. A system install on your PATH or `FFMPEG_PATH` in `.env` still takes precedence. (#1)\n- **Generated content actually reaches the publish queue** — the `\u002Fgenerate` pipeline previously produced a video and then never scheduled it, so \"Processing publish queue\" ran forever with nothing to do. It now queues every successful production. (#2)\n- **Real .mp4 output without paid keys** — if TTS isn't configured, the slideshow renders as a silent video instead of dying on a placeholder file. Placeholder `.info` assets are filtered out of slides. (#4)\n- **No more silent failures** — a capability check at startup shows exactly which pipeline stages will run for real (✓) vs. what's missing and how to fix it (✗). Productions that only produced placeholders are marked `simulated`, are never scheduled for upload, and log a loud warning. (#4, #8, #13)\n- **Setup wizard no longer hard-aborts** — missing credentials or FFmpeg produce warnings with fix instructions instead of `❌ Setup failed!`. (#9)\n- **Publish-queue logging is informative** — shows how many items are waiting and when the next publish happens, instead of an identical line every 15 minutes. (#2)\n\n## What's New in v2.1\n\n- **Real AI generation wired in** — the Content Strategy, Script Writer, and SEO agents now call your configured AI provider (OpenAI, OpenRouter, Kimi, MiMo, GLM, or Gemini) for topics, scripts, titles, descriptions, and tags. If no provider key is set, they fall back to the built-in templates so the pipeline still runs.\n- **API protection** — set `API_KEY` in `.env` and the mutating endpoints (`POST \u002Fgenerate`, `POST \u002Fpublish\u002F:id`) require a matching `x-api-key` header. Request bodies are validated and size-limited.\n- **Safer publishing** — default privacy is now `private` (set `DEFAULT_PRIVACY_STATUS=public` to opt in), and the uploader streams the real video file — it refuses to upload placeholder assets from simulated runs.\n- **Startup and scheduler fixes** — added the missing `sharp` dependency (the app previously crashed on boot), created the missing `automation_events` table (every scheduled task previously threw on logging), fixed the double-insert in the content pipeline, and fixed the publish-queue removal.\n- **No more fabricated statistics** — template scripts no longer invent numbers like \"90% of people…\".\n- **Cleaner repo** — removed two dead OAuth flows (`authenticate.js`, `simple-auth.js` used Google's long-deprecated OOB flow), dead dependencies (`cron`, `jimp`), broken npm scripts, and committed build artifacts. Added ESLint (`npm run lint`) and GitHub Actions CI.\n\n## What's New in v2.0\n\n- **Model upgrades across the board** — GPT-5.5 \u002F GPT-5.5 Instant replace GPT-4-turbo, GPT Image 2 replaces DALL-E 3, Gemini 3.5 Flash\u002FPro replace Gemini 1.x, ElevenLabs Eleven v3 replaces v1, Wan 2.7 replaces Stable Video Diffusion\n- **OpenAI SDK v6** — upgraded from v4, along with `@google\u002Fgenai` v2.9, `replicate` v1.4, `googleapis` v173\n- **Revamped setup wizard** — new TTS service picker (OpenAI TTS \u002F ElevenLabs \u002F Azure), ElevenLabs credential setup, updated model selection menus\n- **Fixed deprecated API patterns** — OpenAI v3 SDK calls in credential testing replaced with v4+ patterns\n- **Dynamic year in content strategy** — no more hardcoded \"2025\" in trend analysis prompts\n- **README rewrite** — developer-focused docs with Mermaid architecture diagrams, no fluff\n\n---\n\nFully automated YouTube channel management system. AI agents handle content strategy, scriptwriting, thumbnail generation, SEO, publishing, and analytics — end to end, on a daily schedule.\n\n## Built by\n\n[@darkzOGx](https:\u002F\u002Fgithub.com\u002FdarkzOGx). Solo builder shipping AI automation and developer tools.\n\nFind me on [X](https:\u002F\u002Fx.com\u002FdarkzOGx) and [laderalabs.io](https:\u002F\u002Fladeralabs.io).\n\nIf this saves you time, a star helps it reach more developers.\n\n## Architecture\n\n```mermaid\ngraph TD\n    A[Content Strategy Agent] --> B[Script Writer Agent]\n    B --> C[Thumbnail Designer Agent]\n    B --> D[SEO Optimizer Agent]\n    C --> E[Production Management Agent]\n    D --> E\n    E --> F[Publishing & Scheduling Agent]\n    F --> G[Analytics & Optimization Agent]\n    G -->|feedback loop| A\n```\n\n## How It Works\n\nEach agent handles one stage of the pipeline:\n\n| Agent | Role |\n|-------|------|\n| **Content Strategy** | Analyzes YouTube trends, identifies topics, plans content calendar |\n| **Script Writer** | Generates scripts with hooks, storytelling, CTAs |\n| **Thumbnail Designer** | Creates thumbnails, runs A\u002FB variations |\n| **SEO Optimizer** | Keywords, titles, descriptions, tags |\n| **Production** | Coordinates TTS audio, image assets, video assembly |\n| **Publishing** | Uploads, schedules, manages playlists |\n| **Analytics** | Tracks performance, feeds insights back to strategy |\n\n## AI Providers\n\nAll OpenAI-compatible providers work out of the box — the system auto-configures the SDK base URL. Pick one, or use OpenRouter to access everything through a single key.\n\n```mermaid\ngraph LR\n    subgraph Direct\n        OA[OpenAI\u003Cbr\u002F>GPT-5.5]\n        GM[Gemini\u003Cbr\u002F>3.5 Flash\u002FPro]\n        KM[Kimi\u003Cbr\u002F>K2.6]\n        MM[MiMo\u003Cbr\u002F>V2.5 Pro]\n        GL[GLM\u003Cbr\u002F>GLM-5]\n    end\n    subgraph Router\n        OR[OpenRouter\u003Cbr\u002F>300+ models]\n    end\n    Direct --> YAA[YouTube Automation Agent]\n    Router --> YAA\n```\n\n| Provider | Models | Base URL | Cost |\n|----------|--------|----------|------|\n| **OpenAI** | GPT-5.5, GPT-5.5 Instant | `api.openai.com\u002Fv1` | ~$0.05–0.20\u002Fvideo |\n| **OpenRouter** | 300+ (GPT, Claude, Gemini, Kimi, GLM, etc.) | `openrouter.ai\u002Fapi\u002Fv1` | varies by model |\n| **Google Gemini** | Gemini 3.5 Flash, 3.5 Pro | via `@google\u002Fgenai` SDK | free tier available |\n| **Kimi (Moonshot AI)** | Kimi K2.6, K2.5 | `api.moonshot.ai\u002Fv1` | ~80% cheaper than GPT-5.5 |\n| **MiMo (Xiaomi)** | MiMo V2.5 Pro, V2.5 | `api.xiaomimimo.com\u002Fv1` | competitive |\n| **GLM (Zhipu AI)** | GLM-5, GLM-5.1 | `api.z.ai\u002Fapi\u002Fpaas\u002Fv4\u002F` | ~$1\u002FM input tokens |\n\nAdditional integrations: Anthropic Claude (`claude-opus-4-8`), ElevenLabs (Eleven v3 TTS), Replicate (Wan 2.7 video), local models via Ollama, any OpenAI-compatible endpoint.\n\n## Quick Start\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fyoutube-automation-agent.git\ncd youtube-automation-agent\nnpm install\nnpm run walkthrough   # guided first-time setup: explains everything, tests your keys live\nnpm start\n```\n\nDashboard runs at `http:\u002F\u002Flocalhost:3456`.\n\nAlready know what you're doing? `npm run setup` offers a classic quick mode, and `.env.example` documents every setting.\n\n### Prerequisites\n\n- Node.js 18+\n- FFmpeg — bundled automatically via `ffmpeg-static` on `npm install`; a system install on your PATH or an `FFMPEG_PATH` env var takes precedence\n- Google account (YouTube Data API — free)\n- At least one AI provider key (OpenAI, Gemini, OpenRouter, Kimi, MiMo, or GLM) — without one, agents fall back to template-based generation\n- Images and narration come from your AI key: OpenAI **or Gemini** both cover image generation and TTS (ElevenLabs \u002F Azure Speech optional for premium voices) — with no media provider at all you get gradient slides and silent video\n\n## Configuration\n\n### API Keys\n\n#### YouTube Data API (required, free)\n\n1. Create a project in [Google Cloud Console](https:\u002F\u002Fconsole.cloud.google.com\u002F)\n2. Enable **YouTube Data API v3**\n3. Create an OAuth 2.0 client (Desktop app)\n4. Save the JSON as `config\u002Fcredentials.json`\n\n#### OpenAI\n\n1. Get a key from [platform.openai.com](https:\u002F\u002Fplatform.openai.com\u002F)\n2. Set `OPENAI_API_KEY` in `.env`\n\n#### OpenRouter (easiest — one key, all models)\n\n1. Get a key from [openrouter.ai\u002Fkeys](https:\u002F\u002Fopenrouter.ai\u002Fkeys)\n2. Set `OPENROUTER_API_KEY` in `.env`\n\n#### Google Gemini\n\n1. Get a key from [Google AI Studio](https:\u002F\u002Faistudio.google.com\u002F)\n2. Set `GEMINI_API_KEY` in `.env`\n\n#### Kimi \u002F MiMo \u002F GLM\n\n| Provider | Get key at | Env var |\n|----------|-----------|---------|\n| Kimi (Moonshot AI) | [platform.kimi.ai](https:\u002F\u002Fplatform.kimi.ai) | `MOONSHOT_API_KEY` |\n| MiMo (Xiaomi) | [mimo.mi.com](https:\u002F\u002Fmimo.mi.com) | `MIMO_API_KEY` |\n| GLM (Zhipu AI) | [z.ai](https:\u002F\u002Fz.ai) | `GLM_API_KEY` |\n\n### Environment Variables\n\n```env\n# AI provider — pick one (or use OpenRouter for access to all)\nOPENAI_API_KEY=sk-...\n# OPENROUTER_API_KEY=sk-or-...\n# GEMINI_API_KEY=...\n# MOONSHOT_API_KEY=...\n# MIMO_API_KEY=...\n# GLM_API_KEY=...\n\n# Optional: premium TTS\n# ELEVENLABS_API_KEY=...\n# ELEVENLABS_VOICE_ID=...\n\n# Optional: AI video generation\n# REPLICATE_API_KEY=...\n\n# App config\nNODE_ENV=production\nPORT=3456\nCHANNEL_NAME=Your Channel Name\nTARGET_AUDIENCE=Your target audience\nYOUTUBE_REGION=US\nDEFAULT_PRIVACY_STATUS=private\n\n# Optional: protect mutating API routes (POST \u002Fgenerate, \u002Fpublish)\n# API_KEY=some-long-random-string\n```\n\n## Automation Schedule\n\n```mermaid\ngantt\n    title Daily Pipeline\n    dateFormat HH:mm\n    axisFormat %H:%M\n\n    section Content\n    Generate content (strategy + script + thumbnail + SEO) :06:00, 2h\n\n    section Publishing\n    Process publishing queue :crit, 08:00, 14h\n\n    section Analytics\n    Collect analytics     :09:00, 1h\n    Run optimizations     :22:00, 1h\n```\n\nThe scheduler runs automatically after `npm start`. Content generation at 06:00, publishing queue processed every 15 minutes, analytics at 09:00, optimization at 22:00. Weekly strategy reviews run on Sundays.\n\n## API\n\n```bash\n# health check\ncurl http:\u002F\u002Flocalhost:3456\u002Fhealth\n\n# generate a video on demand (send x-api-key if API_KEY is set in .env)\ncurl -X POST http:\u002F\u002Flocalhost:3456\u002Fgenerate \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"x-api-key: $API_KEY\" \\\n  -d '{\"topic\": \"Top 10 Life Hacks\", \"style\": \"list\"}'\n\n# view schedule\ncurl http:\u002F\u002Flocalhost:3456\u002Fschedule\n\n# get analytics\ncurl http:\u002F\u002Flocalhost:3456\u002Fanalytics\n\n# publish a specific content item\ncurl -X POST http:\u002F\u002Flocalhost:3456\u002Fpublish\u002F:contentId\n```\n\n## Production Pipeline\n\n```mermaid\nflowchart LR\n    subgraph TTS[\"Audio Generation\"]\n        direction TB\n        EL[ElevenLabs v3] -.->|fallback| OA[OpenAI TTS]\n        OA -.->|fallback| SIM1[Simulation]\n    end\n\n    subgraph IMG[\"Image Generation\"]\n        direction TB\n        GPT[GPT Image 2] -.->|fallback| SIM2[Simulation]\n    end\n\n    subgraph VID[\"Video Assembly\"]\n        direction TB\n        WAN[Wan 2.7 I2V] -.->|fallback| PW[Playwright Slideshow]\n        PW -.->|fallback| SIM3[Simulation]\n    end\n\n    TTS --> MIX[FFmpeg Mux]\n    IMG --> VID\n    VID --> MIX\n    MIX --> OUT[Final Video]\n```\n\nEach stage has graceful fallbacks. If a paid API key isn't configured, the system simulates that step so the rest of the pipeline still runs.\n\n## Extending\n\n### Custom AI provider\n\n```javascript\n\u002F\u002F utils\u002Fai-service.js\nconst Anthropic = require('@anthropic-ai\u002Fsdk');\n\nclass ClaudeAIService {\n  constructor(apiKey) {\n    this.client = new Anthropic({ apiKey });\n  }\n  async generateContent(prompt) {\n    const message = await this.client.messages.create({\n      model: 'claude-opus-4-8',\n      max_tokens: 1024,\n      messages: [{ role: 'user', content: prompt }]\n    });\n    return message.content[0].text;\n  }\n}\n```\n\n### Custom content types\n\n```javascript\n\u002F\u002F agents\u002Fcontent-strategy-agent.js\nconst contentTypes = {\n  'podcast': {\n    duration: '10-15 minutes',\n    style: 'conversational',\n    thumbnail: 'podcast-style'\n  },\n};\n```\n\n## Project Structure\n\n```\nyoutube-automation-agent\u002F\n├── agents\u002F          # one file per agent\n├── config\u002F          # credentials, example configs\n├── database\u002F        # SQLite schema and access layer\n├── data\u002F            # generated content and assets\n├── schedules\u002F       # cron-based automation\n├── utils\u002F           # AI service wrappers, logging, credential management\n├── .github\u002F         # CI workflow (lint + tests on every push\u002FPR)\n└── index.js         # Express server + agent initialization\n```\n\n## Troubleshooting\n\n| Problem | Fix |\n|---------|-----|\n| `Missing credentials for: an AI provider` | Configure any one provider with `npm run credentials:setup` — OpenAI is not required |\n| `'ffmpeg' is not recognized` \u002F no .mp4 produced | Run `npm install` (fetches the bundled binary), or install FFmpeg and set `FFMPEG_PATH` |\n| Video marked `simulated`, nothing uploads | Check the ✗ lines in the startup capability check — a key or FFmpeg is missing |\n| \"Processing publish queue\" but nothing publishes | The queue log now shows what's waiting; content publishes at its scheduled time (default: next day 2 PM) |\n| YouTube API quota exceeded | Check quotas in Google Cloud Console; reduce posting frequency |\n| Content generation failed | Verify API keys and credits; check `logs\u002F` |\n| Publishing failed | Re-authenticate YouTube OAuth tokens; check video format |\n\nEnable debug logging:\n\n```bash\nNODE_ENV=development DEBUG_MODE=true npm start\n```\n\n## More Tools by darkzOGx\n\nIf this was useful, check out:\n\n- [darkzloop](https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fdarkzloop): terminal agent runner that turns any LLM into a disciplined software engineer (FSM control, model-agnostic, BYO auth)\n- [darkzBOX](https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002FdarkzBOX): open-source Instantly.ai clone with smart automated email replies\n- [open-sales-researcher](https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fopen-sales-researcher): autonomous B2B company research. Works with Claude Code, Cursor, Copilot.\n- [darkzseo](https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fdarkzseo): SEO tooling\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for ground rules (short version: one focused concern per PR, no lockfile churn, lint + tests must pass). For questions and setup help, use [Discussions](https:\u002F\u002Fgithub.com\u002FdarkzOGx\u002Fyoutube-automation-agent\u002Fdiscussions) — Issues is for bugs.\n\n1. Fork the repo\n2. Create a feature branch\n3. Make changes and add tests\n4. Submit a PR\n\n```bash\ngit clone \u003Cyour-fork>\ncd youtube-automation-agent\nnpm install\nnpm run lint   # must pass — CI runs this on every PR\nnpm test\n```\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n## Acknowledgments\n\n- [OpenAI](https:\u002F\u002Fopenai.com\u002F) — GPT-5.6 Sol, GPT Image 2, GPT-4o-mini-tts\n- [OpenRouter](https:\u002F\u002Fopenrouter.ai\u002F) — unified multi-model API\n- [Google](https:\u002F\u002Fai.google.dev\u002F) — YouTube Data API, Gemini 3.6 Flash\n- [Moonshot AI](https:\u002F\u002Fwww.moonshot.ai\u002F) — Kimi K3\n- [Xiaomi](https:\u002F\u002Fmimo.mi.com\u002F) — MiMo V2.5 Pro\n- [Zhipu AI](https:\u002F\u002Fz.ai\u002F) — GLM-5.2\n- [ElevenLabs](https:\u002F\u002Felevenlabs.io\u002F) — Eleven v3 TTS\n- [Replicate](https:\u002F\u002Freplicate.com\u002F) — Wan 2.7 video generation\n- [ConstructionBids.ai](https:\u002F\u002Fconstructionbids.ai) - AI scans every federal, state & local public works bid and matches you to contracts you'll win.\n\n---\n\n> This tool is for legitimate content creation. Comply with [YouTube's Terms of Service](https:\u002F\u002Fwww.youtube.com\u002Ft\u002Fterms) and Community Guidelines.\n","这是一个面向 YouTube 频道的全自动内容管理工具，利用 AI 代理完成脚本生成、配音、视频合成、SEO 优化、缩略图制作及发布全流程。支持免费 Gemini API 或 OpenAI，内置 FFmpeg 静态二进制包、浏览器 OAuth 自动授权、.env 环境变量可靠加载，并提供交互式首次配置向导。无需编码，适合个人创作者、小型团队或副业运营者批量运营低干预型 YouTube 频道，尤其适用于知识科普、教程解说、AI 工具测评等结构化视频场景。",2,"trending"]