youtube-publisher
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYouTube Publisher
YouTube Publisher
First time? Ifabove, runsetup_complete: falsefirst, then set./SETUP.md.setup_complete: true
Upload videos to YouTube with full metadata control.
首次使用? 如果上方的,请先运行setup_complete: false,然后将./SETUP.md设置为setup_complete。true
上传视频至YouTube,可全面控制元数据。
Quick Start
快速开始
bash
cd ~/.claude/skills/youtube-publisher/scriptsbash
cd ~/.claude/skills/youtube-publisher/scriptsFirst time: authenticate
首次使用:进行身份验证
npx ts-node youtube-upload.ts --auth
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
--video /path/to/video.mp4
--title "My Awesome Video"
--description "Check out this amazing content!"
--tags "tech,ai,tutorial"
--privacy unlisted
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
--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)
上传为YouTube Short(竖屏视频)
npx ts-node youtube-upload.ts
--video /path/to/short.mp4
--title "Quick Tip #Shorts"
--description "A quick tip for you!"
--privacy public
--short
--video /path/to/short.mp4
--title "Quick Tip #Shorts"
--description "A quick tip for you!"
--privacy public
--short
undefinednpx ts-node youtube-upload.ts
--video /path/to/short.mp4
--title "Quick Tip #Shorts"
--description "A quick tip for you!"
--privacy public
--short
--video /path/to/short.mp4
--title "Quick Tip #Shorts"
--description "A quick tip for you!"
--privacy public
--short
undefinedOptions
选项
| Option | Short | Description |
|---|---|---|
| | Video file path (required) |
| | Video title (required) |
| | Video description |
| Comma-separated tags | |
| | Privacy: public, unlisted, private (default: unlisted) |
| | Category ID (default: 22 = People & Blogs) |
| Custom thumbnail image (local path or URL) | |
| Subtitle file path (SRT/VTT) | |
| Subtitle language code (default: zh) | |
| Subtitle display name (default: 中文) | |
| Add to playlist ID | |
| Mark as YouTube Short | |
| Run OAuth2 authentication flow | |
| Preview without uploading |
| 选项 | 简写 | 说明 |
|---|---|---|
| | 视频文件路径(必填) |
| | 视频标题(必填) |
| | 视频描述 |
| 逗号分隔的标签 | |
| | 隐私设置:public(公开)、unlisted(不公开可分享)、private(私有)(默认:unlisted) |
| | 分类ID(默认:22 = 人物与博客) |
| 自定义缩略图(本地路径或URL) | |
| 字幕文件路径(SRT/VTT格式) | |
| 字幕语言代码(默认:zh) | |
| 字幕显示名称(默认:中文) | |
| 添加至播放列表ID | |
| 标记为YouTube Short | |
| 运行OAuth2身份验证流程 | |
| 预览上传内容,不实际上传 |
Category IDs
分类ID
| ID | Category |
|---|---|
| 1 | Film & Animation |
| 2 | Autos & Vehicles |
| 10 | Music |
| 15 | Pets & Animals |
| 17 | Sports |
| 19 | Travel & Events |
| 20 | Gaming |
| 22 | People & Blogs |
| 23 | Comedy |
| 24 | Entertainment |
| 25 | News & Politics |
| 26 | Howto & Style |
| 27 | Education |
| 28 | Science & Technology |
| ID | 分类 |
|---|---|
| 1 | 电影与动画 |
| 2 | 汽车与交通工具 |
| 10 | 音乐 |
| 15 | 宠物与动物 |
| 17 | 体育 |
| 19 | 旅行与活动 |
| 20 | 游戏 |
| 22 | 人物与博客 |
| 23 | 喜剧 |
| 24 | 娱乐 |
| 25 | 新闻与政治 |
| 26 | 教程与风格 |
| 27 | 教育 |
| 28 | 科学与技术 |
Authentication
身份验证
First-time setup requires OAuth2 authentication:
- Run
npx ts-node youtube-upload.ts --auth - Browser opens Google login
- Grant permissions to upload videos
- Token is saved to
.youtube-token.json
Token refreshes automatically. Re-run if expired.
--auth首次设置需要OAuth2身份验证:
- 运行
npx ts-node youtube-upload.ts --auth - 浏览器将打开Google登录页面
- 授予视频上传权限
- 令牌将保存至
.youtube-token.json
令牌会自动刷新。如果过期,请重新运行。
--authEnvironment
环境配置
Create :
scripts/.envenv
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secretGet credentials from Google Cloud Console:
- Create project at console.cloud.google.com
- Enable YouTube Data API v3
- Create OAuth2 credentials (Desktop app)
- Download and extract client_id & client_secret
创建文件:
scripts/.envenv
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret从Google Cloud Console获取凭证:
- 在console.cloud.google.com创建项目
- 启用YouTube Data API v3
- 创建OAuth2凭证(桌面应用)
- 下载并提取client_id和client_secret
Examples
示例
Upload Tutorial Video
上传教程视频
bash
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 publicbash
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 publicUpload YouTube Short
上传YouTube Short
bash
npx ts-node youtube-upload.ts \
-v short_video.mp4 \
-t "Mind-blowing AI trick! #Shorts" \
-d "This will change how you work! #AI #Tech" \
--privacy public \
--shortbash
npx ts-node youtube-upload.ts \
-v short_video.mp4 \
-t "Mind-blowing AI trick! #Shorts" \
-d "This will change how you work! #AI #Tech" \
--privacy public \
--shortUpload to Playlist
上传至播放列表
bash
npx ts-node youtube-upload.ts \
-v episode5.mp4 \
-t "Podcast Episode 5" \
--playlist PLxxxxxxxxxxxxxx \
--privacy unlistedbash
npx ts-node youtube-upload.ts \
-v episode5.mp4 \
-t "Podcast Episode 5" \
--playlist PLxxxxxxxxxxxxxx \
--privacy unlistedUpload with Thumbnail and Subtitles
上传带缩略图和字幕的视频
bash
npx ts-node youtube-upload.ts \
-v tutorial.mp4 \
-t "Tutorial with Subtitles" \
-d "Learn step by step with subtitles" \
--thumbnail /path/to/cover.jpg \
--subtitles /path/to/subtitles.srt \
--subtitle-lang zh \
--subtitle-name "中文" \
--privacy publicbash
npx ts-node youtube-upload.ts \
-v tutorial.mp4 \
-t "Tutorial with Subtitles" \
-d "Learn step by step with subtitles" \
--thumbnail /path/to/cover.jpg \
--subtitles /path/to/subtitles.srt \
--subtitle-lang zh \
--subtitle-name "中文" \
--privacy publicUpload with Local Thumbnail
上传带本地缩略图的视频
bash
npx ts-node youtube-upload.ts \
-v video.mp4 \
-t "My Video Title" \
--thumbnail "/Users/m/Downloads/shell/work/cover.jpg" \
--privacy publicbash
npx ts-node youtube-upload.ts \
-v video.mp4 \
-t "My Video Title" \
--thumbnail "/Users/m/Downloads/shell/work/cover.jpg" \
--privacy publicOutput
输出
On success, returns:
- Video ID
- Video URL (https://youtu.be/VIDEO_ID)
- Status
上传成功后,将返回:
- 视频ID
- 视频链接(https://youtu.be/VIDEO_ID)
- 状态
Limitations
限制条件
- Max file size: 256GB (YouTube limit)
- Supported formats: MP4, MOV, AVI, WMV, FLV, 3GP, MPEG
- Supported subtitle formats: SRT, VTT
- Daily upload quota: 10,000 units (typically ~6 videos/day)
- Title max: 100 characters
- Description max: 5,000 characters
- Tags max: 500 characters total
- 最大文件大小:256GB(YouTube限制)
- 支持格式:MP4、MOV、AVI、WMV、FLV、3GP、MPEG
- 支持字幕格式:SRT、VTT
- 每日上传配额:10,000单位(通常约6个视频/天)
- 标题最大长度:100字符
- 描述最大长度:5,000字符
- 标签总长度上限:500字符