跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
视频与音频

youtube-publisher

Upload and fully manage YouTube videos and live events: metadata, thumbnails, captions, playlists, scheduled broadcasts, encoder streams, binding, lifecycle transitions, and cleanup.

wlzh · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add wlzh/skills --skill youtube-publisher

技能说明


name: youtube-publisher description: "Upload and fully manage YouTube videos and live events: metadata, thumbnails, captions, playlists, scheduled broadcasts, encoder streams, binding, lifecycle transitions, and cleanup." version: 1.7.0 setup_complete: true setup: "./SETUP.md" changelog: "v1.7.0: full YouTube Live lifecycle with writable-field-safe updates, fail-closed ambiguous upload recovery, non-destructive caption upsert, OAuth CSRF protection, secret-safe output, explicit destructive-operation guards, regression tests, and CI. Full history: references/CHANGELOG.md."

🔴 Strict Execution Rule (Highest Priority)

Every instruction, step, and check in this SKILL.md must be followed exactly as written — no deviations allowed.

  • Scripts must be actually executed: The youtube-upload.ts script must be run with all required parameters. Do not simulate or manually construct API calls.
  • Steps must not be skipped or merged: Execute authentication, metadata sanitization, and upload in the defined order. Each step must succeed before the next begins.
  • Checks must not be omitted: All metadata validation (title ≤100 chars, description ≤5000 chars, tags ≤500 chars) and upload verification must be fully executed.
  • Config must be read from files: OAuth credentials and default settings must be read from the configured files. Do not hardcode.

YouTube Publisher

First time? If setup_complete: false above, run ./SETUP.md first, then set setup_complete: true.

Upload videos to YouTube with full metadata control.

Live broadcasts and encoder streams

Use youtube-live.ts to list, inspect, schedule, update, bind, transition, and delete YouTube Live broadcasts and encoder streams. Mutating commands support --dry-run; destructive deletion, live/completed transitions, and stream-key disclosure require explicit --yes. Stream keys are redacted from ordinary output.

The safe default is one dedicated named encoder stream per independent show/event. Intentional reuse across active or upcoming broadcasts requires --allow-shared-stream.

Read references/live-streaming.md before operating a live event. Scheduled timestamps must include an explicit timezone (Z or ±HH:MM).

The skill passes --inherit-previous before creation unless the user requests a clean profile. The raw CLI remains deterministic and offline without that explicit flag.

An interrupted video insert is never retried inside youtube-upload.ts. Recovery must identify exactly one recent same-title video with a verified non-zero duration. Persistent P0D exits 42 with PERSISTENT_P0D_VIDEO_ID; unavailable or inconclusive inspection exits 43 with AMBIGUOUS_UPLOAD_VIDEO_ID. Inspect the channel before another insert.

Caption recovery updates one exact language/name track in place or inserts a new track. It never deletes an existing caption before the replacement upload succeeds.

Metadata sanitization

  • > in title/description is automatically rewritten to 》
  • < in title/description is automatically rewritten to 《
  • Use this when YouTube rejects metadata because of special characters

Quick Start

cd ~/.claude/skills/youtube-publisher/scripts

# First time: authenticate
npx ts-node youtube-upload.ts --auth

# Upload video
npx ts-node youtube-upload.ts \
  --video /path/to/video.mp4 \
  --title "My Awesome Video" \
  --description "Check out this amazing content!" \
  --tags "tech,ai,tutorial" \
  --privacy unlisted

# Upload as YouTube Short (vertical video)
npx ts-node youtube-upload.ts \
  --video /path/to/short.mp4 \
  --title "Quick Tip #Shorts" \
  --description "A quick tip for you!" \
  --privacy public \
  --short

Options

OptionShortDescription
--video-vVideo file path (required)
--title-tVideo title (required)
--description-dVideo description
--tagsComma-separated tags
--privacy-pPrivacy: public, unlisted, private (default: unlisted)
--category-cCategory ID (default: 22 = People & Blogs)
--thumbnailCustom thumbnail image (local path or URL)
--subtitlesSubtitle file path (SRT/VTT)
--subtitle-langSubtitle language code (default: zh)
--subtitle-nameSubtitle display name (default: 中文)
--playlistAdd to playlist ID
--shortMark as YouTube Short
--authRun OAuth2 authentication flow
--dry-runPreview without uploading

Category IDs

IDCategory
1Film & Animation
2Autos & Vehicles
10Music
15Pets & Animals
17Sports
19Travel & Events
20Gaming
22People & Blogs
23Comedy
24Entertainment
25News & Politics
26Howto & Style
27Education
28Science & Technology

Authentication

First-time setup requires OAuth2 authentication:

  1. Run npx ts-node youtube-upload.ts --auth
  2. Browser opens Google login
  3. Grant permissions to upload videos
  4. Token is saved to .youtube-token.json

Token refreshes automatically. Re-run --auth if expired.

Environment

Create scripts/.env:

YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret

Get credentials from Google Cloud Console:

  1. Create project at console.cloud.google.com
  2. Enable YouTube Data API v3
  3. Create OAuth2 credentials (Desktop app)
  4. Download and extract client_id & client_secret

Examples

Upload Tutorial Video

npx ts-node youtube-upload.ts \
  -v tutorial.mp4 \
  -t "How to Use Claude Code - Complete Guide" \
  -d "Learn everything about Claude Code in this comprehensive tutorial.

Timestamps:
00:00 Introduction
02:30 Getting Started
05:00 Advanced Features

#ClaudeCode #AI #Tutorial" \
  --tags "claude code,ai,tutorial,anthropic,coding" \
  --category 28 \
  --privacy public

阅读完整来源 ↗