youtube-shorts-pipeline

rushindrasinhaMIT更新放缓

把新闻自动做成 YouTube Shorts 的流水线:生成脚本、AI 画面、配音、字幕并上传,省去手工剪辑。

Automated YouTube Shorts pipeline: news → script → AI visuals → voiceover → captions → upload

v3.1.0发布于 2026-06-09 23:55 UTC2,362star541fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/rushindrasinha/youtube-shorts-pipeline.git
cd youtube-shorts-pipeline
pip install -r requirements.txt
python -m verticals run --topic "your topic" --niche tech
硬件要求按 README 说明

README 未说明显存或 GPU 要求;可用本地 Ollama 跑 LLM,Edge TTS 免费跨平台,macOS 可用 say 作为配音回退。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

输入话题即可自动完成调研、脚本、画面、配音、字幕并上传 YouTube Shorts 的开源内容引擎

把新闻自动做成 YouTube Shorts 的流水线:生成脚本、AI 画面、配音、字幕并上传,省去手工剪辑。

核心能力

  • 用 DuckDuckGo 调研并抓取来源,脚本只使用调研事实
  • 按 niche YAML 配置塑造脚本语气、画面风格与音乐情绪
  • 用 Gemini Imagen 生成 3 张 b-roll 并自动裁成 9:16
  • 用 Whisper 生成词级时间戳,输出 ASS 烧录与 SRT 字幕
  • 用 ffmpeg 合成 Ken Burns 动效、背景音乐与自动压低人声

容易踩的坑

edge-tts 必须锁定可用版本,6.x 会被微软以 403 拒绝;Gemini 画面生成需要 GEMINI_API_KEY,否则只能用纯色回退帧;YouTube 上传需先完成 OAuth 设置向导,且默认上传为私有。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v3.1.0
  1. v3.1.0v3.1.0 — community providers, CJK captions, reliability fixes最新正式版2026-06-09 · 2026-06-09 23:55 UTC

    Merged community contributions

    • CJK caption rendering (#13, @chimaek): niche profile captions.font_family and captions.font_size are now wired into the generated ASS style, so Korean/Japanese/Chinese and other non-Latin scripts render with the right font instead of boxes.
    • MiniMax provider (#12, @octo-patch): optional LLM (chat completions) and TTS (streaming) behind MINIMAX_API_KEY. No new dependencies; ships with mocked tests.
    • 60db TTS provider (#20, @Dev-develope): optional TTS behind SIXTYDB_API_KEY with native Indic-language voices, per-niche voice settings, and a python -m verticals voices --provider 60db listing command.

    Fixes

    • edge-tts pin bumped to >=7.0,<8.0. The 6.x client is rejected by Microsoft's endpoint with HTTP 403, which broke the default free TTS path. Verified against the live endpoint.
    • Missing GEMINI_API_KEY no longer surfaces as a cryptic 403: Method doesn't allow unregistered callers (#11): b-roll falls back with a clear message, thumbnails fail fast, and 403 errors hint at AI Studio vs Vertex credential type.
    • ffmpeg builds without libass no longer crash assembly; caption burn-in is skipped with a warning and the SRT still uploads.
    • SKILL.md and references/setup.md now use --topic consistently (#14) and the python3 python -m verticals typo is gone.
    • TTS fallback chain is now edge → minimax → elevenlabs → 60db → say.

    Docs

    • New examples/ directory with two verified end-to-end walkthroughs: a full tech-news Short and a zero-cost Ollama draft with topic discovery (#8).
    • README now documents all three Claude auth paths — API key, claude login, and CLAUDE_CODE_OAUTH_TOKEN from claude setup-token — and the latter is now accepted as a CLI credential source for headless use (#5).

    Full changelog: https://github.com/rushindrasinha/youtube-shorts-pipeline/blob/main/CHANGELOG.md

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Verticals v3

    The open source AI content engine with built-in niche intelligence.

    Topic in. Published Short out. Any niche. ~$0.11 per video.

    Quickstart · Hosted Version

    Repo note: the product is called Verticals v3. The GitHub repository is youtube-shorts-pipeline.

    python -m verticals run --topic "Sam Altman just mass-fired 200 safety researchers" --niche tech
    

    That one command researches the topic, writes a hook driven script tuned to tech YouTube, generates cinematic b roll, records a natural voiceover, burns in animated captions, adds mood matched background music, generates a thumbnail, and uploads it to YouTube. ~90 seconds of video, ~3 minutes of wall time, ~$0.11 in API costs.

    What Changed in v3

    v2 was an esports news pipeline. v3 is a general purpose content engine that works for any niche, any topic, any creator.

    The biggest change: Niche Intelligence. Every stage of the pipeline now reads from a niche profile that shapes script tone, visual style, caption aesthetics, music mood, and thumbnail strategy. Ship a cooking Short and it writes like a cooking creator, generates food photography b roll, and picks warm upbeat background music. Ship a true crime Short and the tone shifts to suspenseful, the visuals go dark and cinematic, and the music drops to ambient tension.

    15 niches ship out of the box. Build your own in 5 minutes.

    Other highlights: multi provider LLM support (Claude, Gemini, GPT, Ollama local), free TTS via Edge TTS, YouTube upload, topic discovery, resumable stages, and a local-first config model.

    Current Release: v3.1.0

    v3.1.0 brings community-contributed providers and reliability fixes: MiniMax (LLM + TTS) and 60db (TTS) as optional providers, niche-aware caption fonts so CJK and other non-Latin scripts render correctly, a working edge-tts pin (6.x is rejected by Microsoft with 403s), and clearer errors for the most-reported setup problems.

    Implemented today:

    • research with DuckDuckGo plus optional source scraping
    • script and metadata generation through Claude, Gemini, GPT, Ollama, MiniMax, LiteLLM, or Claude CLI
    • b roll and thumbnail image generation through Gemini Imagen, with fallback frames
    • voiceover through Edge TTS, ElevenLabs, MiniMax, 60db, or macOS say
    • Whisper captions with ASS burn-in plus SRT export, niche-configurable fonts
    • ffmpeg assembly with Ken Burns motion, background music, and voice ducking
    • private-by-default YouTube upload

    Not shipped yet: Gradio UI, Docker, Colab, TikTok/Reels/X upload, Pexels, Replicate, ComfyUI, and Kokoro TTS. Those are roadmap items, not current features.

    How It Works

    ┌─────────────────────────────────────────────────────────────────┐
    │                        NICHE PROFILE                            │
    │  Loaded once. Shapes every stage. 15 built in or bring your own │
    └─────────────┬───────────────────────────────────────────────────┘
                  │
                  ▼
    ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐
    │ RESEARCH │→ │  SCRIPT  │→ │ VISUALS  │→ │  VOICE   │→ │ CAPTIONS │→ │ ASSEMBLE │→ UPLOAD
    │          │  │          │  │          │  │          │  │          │  │          │
    │ DuckDuck │  │ LLM with │  │ Gemini   │  │ ElevenLabs│  │ Whisper  │  │ ffmpeg   │
    │ Go + web │  │ niche    │  │ fallback │  │ Edge TTS │  │ word     │  │ Ken Burns│
    │ scraping │  │ persona  │  │ frames   │  │ say      │  │ level    │  │ + music  │
    │          │  │ + hooks  │  │          │  │          │  │ ASS+SRT  │  │ ducking  │
    └──────────┘  └──────────┘  └──────────┘  └──────────┘  └──────────┘  └──────────┘
    

    Stage by stage:

    Research — Searches DuckDuckGo (and optionally scrapes source URLs) for live facts. Every name, number, and claim in the final script traces back to this research. This is the anti hallucination gate: the LLM is instructed to use only facts from research data, never its training knowledge.

    Script — An LLM (your choice of provider) writes a 60 to 90 second voiceover script using the niche profile's tone, pacing rules, and hook patterns. The profile tells the LLM things like "open with a question, not a statement" for tech niches or "open with a shocking statistic" for finance niches. Output includes the script, b roll image prompts, thumbnail prompt, and platform metadata for YouTube/TikTok/Instagram/X.

    Visuals — Generates 3 b roll frames via Gemini Imagen, then auto crops them to 9:16 portrait. If image generation fails, the pipeline uses simple fallback frames so assembly can still complete. The niche profile shapes the visual vocabulary: a fitness niche generates gym and movement imagery, a science niche generates diagrams and lab visuals.

    Voice — Text to speech via your configured provider: Edge TTS (free, cross platform, 300+ voices, recommended default), ElevenLabs (premium, most natural), or macOS say (fallback). The niche profile suggests voice characteristics (pace, energy, tone) but the final voice selection is yours.

    Captions — Whisper generates word level timestamps. The pipeline produces both ASS (burned in with word by word yellow highlight) and SRT (uploaded to YouTube for closed captions). Caption styling follows the niche profile: bold energetic fonts for gaming, clean minimal for tech, warm handwritten feel for lifestyle.

    Assemble — ffmpeg combines animated b roll (Ken Burns zoom/pan effects), voiceover, burned in captions, and background music with automatic voice ducking. Music selection is mood matched to the niche profile.

    Upload — Publishes to YouTube (private by default) with title, description, tags, SRT captions, and AI generated thumbnail. TikTok and Instagram export coming in v3.1.

    Niche Intelligence

    This is what makes Verticals different from every other AI video tool.

    A niche profile is a YAML file that tells the pipeline how to think about content for a specific audience. It shapes every stage without requiring any prompt engineering from you.

    # niches/tech.yaml
    name: tech
    display_name: "Tech & AI News"
    
    script:
      tone: "informed, slightly opinionated, conversational"
      pacing: "fast, dense with facts, no filler"
      hooks:
        - pattern: "contrarian_take"
          template: "Everyone is celebrating {topic}. Here's why that's a problem."
        - pattern: "breaking_news"
          template: "This just happened and nobody is talking about it."
        - pattern: "prediction"
          template: "{topic} changes everything. Here's what happens next."
        - pattern: "explainer"
          template: "Let me explain {topic} in 60 seconds because most people are getting this wrong."
        - pattern: "comparison"
          template: "{thing_a} vs {thing_b}. One of these wins and it's not even close."
      cta_variants:
        - "Follow for daily tech breakdowns."
        - "Subscribe. I cover AI news nobody else is talking about."
        - "Drop a comment: do you agree?"
      word_count: "150 to 170"
      forbidden: ["like and subscribe", "smash that bell", "what's up guys"]
    
    visuals:
      style: "clean, minimal, dark backgrounds, neon accents"
      mood: "futuristic, sleek, professional"
      subjects: ["circuit boards", "code on screens", "server rooms", "product shots", "data visualizations"]
      avoid: ["stock photo people smiling at laptops", "generic office", "clipart"]
    
    voice:
      pace: "slightly fast, ~160 wpm"
      energy: "confident, authoritative but not robotic"
      suggested_voices:
        edge_tts: "en-US-GuyNeural"
        elevenlabs: "JBFqnCBsd6RMkjVDRZzb"
    
    captions:
      highlight_color: "#00FF88"
      font_weight: "bold"
      position: "lower_third"
    
    music:
      mood: "ambient electronic, subtle energy, no lyrics"
      energy: "medium"
    
    thumbnail:
      style: "dark background, bold white/green text, product or face focus"
      text_position: "left_aligned"
    

    15 built-in niches plus a general fallback: tech, gaming, finance, fitness, cooking, travel, true_crime, science, politics, entertainment, sports, fashion, education, motivation, comedy, and general.

    Build your own by copying any profile and editing it. Drop the YAML in niches/ and reference it with --niche your_niche_name.

    Quickstart

    CLI

    git clone https://github.com/rushindrasinha/youtube-shorts-pipeline.git
    cd youtube-shorts-pipeline
    pip install -r requirements.txt
    
    python -m verticals run --topic "your topic" --niche tech
    

    The old --news flag still works for backwards compatibility, but --topic is the recommended public API.

    Hosted Version

    Use verticals.gg if you want the workflow without local setup.

    Examples

    Two worked end-to-end examples with real commands and the exact output to expect at each stage live in examples/:

    CLI Commands

    Full pipeline (topic to published Short)

    python -m verticals run --topic "headline" --niche tech
    python -m verticals run --topic "headline" --niche cooking --provider ollama
    python -m verticals run --discover --niche gaming --auto-pick
    

    Individual stages

    python -m verticals draft --topic "headline" --niche tech
    python -m verticals produce --draft <path> --lang en
    python -m verticals upload --draft <path> --lang en
    python -m verticals topics --niche tech --limit 20
    

    Useful flags

    --niche NAME         Niche profile (default: general)
    --provider NAME      LLM provider: claude, gemini, openai, ollama, minimax (default: claude)
    --voice NAME         TTS provider: edge, elevenlabs, minimax, 60db, say (default: edge)
    --platform NAME      Draft target: shorts, reels, tiktok, all (default: shorts)
    --lang CODE          Language: en, hi, es, pt, de, fr, ja, ko (default: en)
    --dry-run            Draft only, skip produce and upload
    --force              Redo all stages even if completed
    --verbose            Debug logging
    

    Provider Support

    LLM (script generation)

    ProviderCostSetupNotes
    Claude (Anthropic)~$0.02/scriptANTHROPIC_API_KEYBest quality. Default.
    Gemini (Google)Free tier availableGEMINI_API_KEYGood quality, generous free tier.
    GPT (OpenAI)~$0.01/scriptOPENAI_API_KEYSolid alternative.
    Ollama (local)FreeInstall Ollama + pull modelNo API key needed. Quality varies by model.
    Claude CLIFree w/ Max subInstall Claude CodeUses Claude Max subscription, no API key. See Claude authentication.
    MiniMaxPay-as-you-goMINIMAX_API_KEYOpenAI-compatible API.

    TTS (voiceover)

    ProviderCostSetupNotes
    Edge TTSFreeNoneRecommended default. 300+ voices, cross platform.
    ElevenLabs~$0.05/videoELEVENLABS_API_KEYMost natural. Premium.
    MiniMaxPay-as-you-goMINIMAX_API_KEYStreaming TTS, English voices.
    60dbPay-as-you-goSIXTYDB_API_KEYNative Indic-language voices, low per-character cost. List voices: python -m verticals voices --provider 60db.
    macOS sayFreemacOS onlyBasic fallback.

    Claude authentication

    The claude provider works with any one of these, checked in order:

    1. ANTHROPIC_API_KEY — a standard Anthropic API key from console.anthropic.com. This is not the same thing as a Claude Code OAuth token; the two are not interchangeable.
    2. A logged-in Claude Code CLI (claude login with a Claude Max subscription). The pipeline shells out to claude -p and no API key is needed.
    3. CLAUDE_CODE_OAUTH_TOKEN — a long-lived token from claude setup-token, with the claude CLI installed. Useful for CI and headless machines. The token is consumed by the CLI, not sent to the Anthropic API directly.

    Visuals (b roll)

    ProviderCostSetupNotes
    Gemini ImagenFree tier availableGEMINI_API_KEYDefault image provider.
    Fallback framesFreeNoneSolid-color fallback frames if image generation fails.

    Upload

    PlatformStatusAuth
    YouTubeStableOAuth (setup wizard)
    TikTokv3.1Coming soon
    Instagram Reelsv3.1Coming soon
    X (Twitter)v3.1Coming soon

    $0.00 Mode (completely free)

    Yes, you can run this with zero API spend:

    python -m verticals draft \
      --topic "your topic" \
      --niche tech \
      --provider ollama
    

    This creates the script and metadata with a local LLM. Full video production still needs visuals, TTS, captions, and ffmpeg; Edge TTS is free, while Gemini visuals require GEMINI_API_KEY.

    Configuration

    All keys stored in ~/.verticals/config.json with 0600 permissions:

    VariableRequiredUsed By
    ANTHROPIC_API_KEYIf using Claude APIScript generation
    CLAUDE_CODE_OAUTH_TOKENIf using Claude CLI headlessScript generation (via claude CLI)
    GEMINI_API_KEYIf using Gemini visuals/LLMB roll + thumbnails
    OPENAI_API_KEYIf using GPTScript generation
    ELEVENLABS_API_KEYIf using ElevenLabsPremium voiceover
    MINIMAX_API_KEYIf using MiniMaxScript generation + voiceover
    SIXTYDB_API_KEYIf using 60dbVoiceover

    Environment variables override config file values.

    Note on GEMINI_API_KEY: it must be an AI Studio key from aistudio.google.com/apikey. Vertex AI or service-account credentials fail with 403: Method doesn't allow unregistered callers. The same 403 appears when the key is simply not set in the environment the pipeline runs in (a common cause inside Docker — pass it with docker run -e GEMINI_API_KEY=...).

    Topic Discovery

    Discover trending topics from multiple sources, filtered by niche relevance:

    python -m verticals topics --niche tech --limit 20
    
    SourceMethodAuthNiche Filtering
    Reddit.json APINoneSubreddit mapping per niche
    RSSfeedparserNoneConfigurable feeds per niche
    Google TrendspytrendsNoneGeo + category filtering
    Twitter/XPublic APIOptionalKeyword filtering
    TikTokApifyOptionalHashtag mapping
    YouTube TrendingRSS/APINoneCategory mapping
    Hacker NewsAPINoneTech/startup default

    Configure per niche in your profile:

    # In niches/tech.yaml
    discovery:
      reddit: ["technology", "artificial", "MachineLearning", "singularity"]
      rss: ["https://hnrss.org/frontpage", "https://techcrunch.com/feed"]
      google_trends_category: "t"
      youtube_trending_category: "28"
    

    Cost Per Video

    ConfigurationCost
    Premium (Claude + Gemini + ElevenLabs)~$0.11
    Budget (Gemini + Gemini + Edge TTS)~$0.04
    Draft-only local (Ollama)$0.00
    Voice-only free path (Edge TTS)$0.00 for voice generation

    Quality Limits

    Verticals is built for repeatable short-form production, not for replacing an editor on story-led creative work.

    It works best for:

    • news explainers
    • niche trend breakdowns
    • list-style educational Shorts
    • fast social experiments where volume matters

    It is not ideal for:

    • cinematic storytelling
    • creator personality pieces
    • videos that require taste, live footage, or strong art direction
    • factual topics where the research source quality is weak

    Use draft --dry-run or run --dry-run when testing a new niche. The most important human checkpoint is the draft: hook, factual claims, and whether the video has a real reason to exist.

    Distribution Loop

    The pipeline is only the production layer. The useful operating loop is:

    • Pick a niche with existing short-form demand.
    • Generate and review a small batch of Shorts.
    • Publish consistently on the platforms where that niche already moves.
    • Use one clear call to action: free resource, newsletter, waitlist, or product.
    • Read performance weekly, then tighten the niche profile and hooks.

    This repo lowers the cost of testing. It does not remove the need for niche selection, distribution taste, or a real conversion path.

    Project Structure

    verticals/
    ├── verticals/
    │   ├── __main__.py            # CLI entry point
    │   ├── config.py              # Keys, paths, setup wizard
    │   ├── niche.py               # Niche profile loader
    │   ├── llm.py                 # Claude / Gemini / GPT / Ollama
    │   ├── research.py            # DuckDuckGo research gate
    │   ├── draft.py               # Script generation with niche intelligence
    │   ├── broll.py               # Gemini image generation + Ken Burns
    │   ├── tts.py                 # ElevenLabs / Edge / say
    │   ├── captions.py            # Whisper + ASS/SRT
    │   ├── music.py               # Track selection + ducking
    │   ├── assemble.py            # ffmpeg final assembly
    │   ├── thumbnail.py           # Thumbnail generation + text overlay
    │   ├── upload.py              # YouTube upload
    │   ├── topics/                # Multi source topic engine
    │   ├── state.py               # Resume capability
    │   ├── retry.py               # Exponential backoff
    │   └── log.py                 # Structured logging
    ├── niches/                    # 15 built in niche profiles
    │   ├── tech.yaml
    │   ├── gaming.yaml
    │   ├── finance.yaml
    │   ├── fitness.yaml
    │   ├── cooking.yaml
    │   ├── travel.yaml
    │   ├── true_crime.yaml
    │   ├── science.yaml
    │   ├── politics.yaml
    │   ├── entertainment.yaml
    │   ├── sports.yaml
    │   ├── fashion.yaml
    │   ├── education.yaml
    │   ├── motivation.yaml
    │   ├── comedy.yaml
    │   └── general.yaml           # Default fallback
    ├── tests/
    ├── scripts/
    │   └── setup_youtube_oauth.py
    ├── references/
    │   ├── setup.md
    │   └── troubleshooting.md
    ├── pyproject.toml
    └── requirements.txt
    

    Testing

    pip install -e ".[dev]"
    python -m pytest tests/ -q
    

    Security

    All security measures from v2 carry forward, plus:

    Credential storage: Config and tokens use 0600 permissions via atomic os.open(). API key handling: All providers send keys via headers, never URL parameters. Upload privacy: YouTube uploads default to private. Prompt injection: Research snippets truncated to 300 chars with boundary markers. LLM output fields are type checked before use. OAuth scopes: Minimum required scopes per platform. Niche profiles: YAML parsed with safe_load (no code execution). Dependency pinning: Compatible release bounds on all packages.

    Roadmap

    v3.0 (this release) Niche intelligence, multi provider LLM support, Edge TTS default, topic discovery, resumable stages, YouTube upload

    v3.1 (planned) TikTok/Instagram/X upload, multi language niche profiles, A/B script variants (generate 2, pick better), scheduled batch production

    v3.2 (planned) Analytics integration (which Shorts performed best), niche profile auto tuning based on performance data, series support (multi episode narrative arcs)

    Later Web UI, Docker, Google Colab, additional visual providers, stock footage fallback

    Built By

    Dr Rushindra Sinha — MD, Stanford GSB, Full Stack Developer.

    Built the first game server at 17 (went #1 globally, acquired before finishing med school). Co-founded Global Esports — South Asia's only Valorant Champions Tour Pacific franchise. Now building AI tools for creators and operators at aarees.com.

    Follow: @irushi on X · @rushindrasinha on Instagram


    More From This Stack

    ProductWhat it does
    verticals.ggHosted version of this pipeline — no setup, no terminal, just results
    thumbnail.ggAI thumbnail generation with deep niche intelligence and CTR optimization
    aarees.comThe AI agent platform powering both products
    Global EsportsSouth Asia's VCT Pacific franchise — where the esports niche profile was battle-tested

    License

    MIT