youtube-uploader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YouTube Uploader

YouTube 视频上传工具

First time? If
setup_complete: false
above, run
./SETUP.md
first, then set
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-uploader/scripts
bash
cd ~/.claude/skills/youtube-uploader/scripts

First time: authenticate

First time: authenticate

npx ts-node youtube-upload.ts --auth
npx ts-node youtube-upload.ts --auth

Upload video

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
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)

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
undefined
npx ts-node youtube-upload.ts
--video /path/to/short.mp4
--title "Quick Tip #Shorts"
--description "A quick tip for you!"
--privacy public
--short
undefined

Options

选项

OptionShortDescription
--video
-v
Video file path (required)
--title
-t
Video title (required)
--description
-d
Video description
--tags
Comma-separated tags
--privacy
-p
Privacy: public, unlisted, private (default: unlisted)
--category
-c
Category ID (default: 22 = People & Blogs)
--thumbnail
Custom thumbnail image path
--playlist
Add to playlist ID
--short
Mark as YouTube Short
--auth
Run OAuth2 authentication flow
--dry-run
Preview without uploading
选项缩写描述
--video
-v
视频文件路径(必填)
--title
-t
视频标题(必填)
--description
-d
视频描述
--tags
逗号分隔的标签
--privacy
-p
隐私设置:公开、不公开可分享、私有(默认:不公开可分享)
--category
-c
分类ID(默认:22 = 人物与博客)
--thumbnail
自定义缩略图图片路径
--playlist
添加至播放列表ID
--short
标记为YouTube Short
--auth
运行OAuth2身份验证流程
--dry-run
预览上传内容,不实际上传

Category IDs

分类ID

IDCategory
1Film & Animation
2Autos & Vehicles
10Music
15Pets & Animals
17Sports
19Travel & Events
20Gaming
22People & Blogs
23Comedy
24Entertainment
25News & Politics
26Howto & Style
27Education
28Science & Technology
ID分类
1电影与动画
2汽车与交通工具
10音乐
15宠物与动物
17体育
19旅行与活动
20游戏
22人物与博客
23喜剧
24娱乐
25新闻与政治
26教程与风格
27教育
28科学与技术

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.
首次使用需要完成OAuth2身份验证:
  1. 运行
    npx ts-node youtube-upload.ts --auth
  2. 浏览器将打开Google登录页面
  3. 授予上传视频的权限
  4. 令牌将保存至
    .youtube-token.json
令牌会自动刷新。如果过期,请重新运行
--auth

Environment

环境配置

Create
scripts/.env
:
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
创建
scripts/.env
文件:
env
YOUTUBE_CLIENT_ID=your_client_id
YOUTUBE_CLIENT_SECRET=your_client_secret
从Google Cloud Console获取凭证:
  1. 在console.cloud.google.com创建项目
  2. 启用YouTube Data API v3
  3. 创建OAuth2凭证(桌面应用)
  4. 下载并提取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 public
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 public

Upload 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 \
  --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 \
  --short

Upload to Playlist

上传至播放列表

bash
npx ts-node youtube-upload.ts \
  -v episode5.mp4 \
  -t "Podcast Episode 5" \
  --playlist PLxxxxxxxxxxxxxx \
  --privacy unlisted
bash
npx ts-node youtube-upload.ts \
  -v episode5.mp4 \
  -t "Podcast Episode 5" \
  --playlist PLxxxxxxxxxxxxxx \
  --privacy unlisted

Output

输出结果

On success, returns:
上传成功后,将返回:

Limitations

限制说明

  • Max file size: 256GB (YouTube limit)
  • Supported formats: MP4, MOV, AVI, WMV, FLV, 3GP, MPEG
  • 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
  • 每日上传配额:10,000单位(通常约6个视频/天)
  • 标题最大长度:100字符
  • 描述最大长度:5,000字符
  • 标签总长度最大:500字符