YouTube 视频上传与编辑
youtube-upload
通过 Data API v3 将视频上传到 YouTube,并在之后编辑其标题、描述、标签或缩略图。适用于发布 YouTube 视频或修改其标题。
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 60
- Forks
- 6
01 前言 Front Matter
- args
- [video-file | video-id]
- name
- youtube-upload
- created
- 1793232000000
- modified
- 1793232000000
- reviewed
- 1793232000000
- description
- Upload a video to YouTube via the Data API v3 and edit its title, description, tags or thumbnail afterwards. Use when publishing or retitling a YouTube video.
- allowed-tools
- Bash(uv run *), Bash(python3 *), Read, AskUserQuestion
- argument-hint
- path to a video to upload, or the id of an uploaded video to edit
02 资源文件 5
- 参考文档REFERENCE.md5.4 KB
- 参考文档references/signal-fields.md4.2 KB
- 脚本scripts/tests/test_youtube_api.py10.7 KB
- 脚本scripts/tests/test-youtube-api.sh1.1 KB
- 脚本scripts/youtube_api.py28.3 KB
03 SKILL.md 正文
YouTube upload and edit (Data API v3)
scripts/youtube_api.py wraps the four calls this needs: a resumable
videos.insert, thumbnails.set, videos.update, and videos.list for
read-back. Every write subcommand has --dry-run, which validates the input
and prints the exact request without network access or the Google client
libraries.
When to Use This Skill
| Use this skill when... | Use instead when... |
|---|---|
| Uploading a video file, setting its metadata and thumbnail | The video should be visible only to a Workspace organization: upload here, then youtube-studio-share |
| Changing a title, description, tags, category or privacy after upload | Generating chapter lines or extracting a thumbnail frame: video-plugin |
Before anything else
- OAuth is set up once.
YOUTUBE_CLIENT_SECRETSmust name a Desktop OAuth client JSON, anduv run ${CLAUDE_SKILL_DIR}/scripts/youtube_api.py authmust have been run. If either is missing, stop and point the user at REFERENCE.md § One-time OAuth setup. The token is cached at${XDG_CONFIG_HOME:-~/.config}/youtube-plugin/token.json(mode 0600), outside any repository. - Confirm the channel. Run
whoamiand show the userCHANNEL_TITLEandCHANNEL_HANDLE. The token belongs to whichever Google account consented, and the wrong account is the common failure: in practice the first browser profile was a personal account and the right one was in a second browser.
Workflow: upload
- Collect the metadata. Title (100 characters max, no
<or>), description file (5000 bytes max), tags, category id (categories --region FIlists valid ids; the default is 22), privacy (defaultprivate). Chapter lines in the description come fromvideo-plugin; the script checks YouTube's chapter rules (first at 0:00, at least 3, each at least 10 s) and reports violations asSTATUS=WARN. - Ask for the two disclosures. Both flags are required, and neither has a
default, because both are the uploader's statement:
--made-for-kids yes|nosetsstatus.selfDeclaredMadeForKids.--synthetic-media yes|nosetsstatus.containsSyntheticMedia, YouTube's disclosure for realistic altered or synthetic content (AI-generated footage or voice included). Whether a video needs it is the uploader's call; ask, never infer.
- Dry run. Show the user
REQUEST_BODY:uv run ${CLAUDE_SKILL_DIR}/scripts/youtube_api.py upload clip.mp4 --title "…" --description-file desc.txt --tag … --made-for-kids no --synthetic-media no --thumbnail thumb.jpg --dry-run - Confirm with
AskUserQuestion, then run the same command without--dry-run. It printsVIDEO_ID,WATCH_URLandSTUDIO_EDIT_URL. A failed thumbnail after a successful upload is aWARN; the video id is still reported, andthumbnail <id> <image>retries only the thumbnail. - Org-only sharing, when asked for, follows in the browser with
youtube-studio-share. The API cannot do it:status.privacyStatusaccepts onlyprivate,publicandunlisted, and no field or method shares a private video with people or a domain.
Workflow: edit after upload
uv run ${CLAUDE_SKILL_DIR}/scripts/youtube_api.py update <id> --title "New title" --dry-run
uv run ${CLAUDE_SKILL_DIR}/scripts/youtube_api.py update <id> --description-file desc.txt
videos.update deletes every mutable property of a named part that the request
omits, so a body carrying only a new title would wipe the description and tags.
update therefore reads the current snippet and status first and resends
them merged with the change. The dry run cannot read the live video; pass
--current-json with a saved videos.list item to preview the merged body.
Verify
Run status <id> after any write and compare TITLE, PRIVACY and
CHAPTER_COUNT against what was sent. Processing is staged: SD is ready first,
HD a few minutes later. PROCESSING_STATUS=processing corresponds to Studio
showing visibility as "Pending" (Odottaa).
Quota
| Call | Cost | Bucket |
|---|---|---|
videos.insert |
1 unit | Video Uploads, 100 calls/day by default |
videos.update |
50 units | shared 10,000 units/day |
thumbnails.set |
50 units | shared |
videos.list, channels.list, videoCategories.list |
1 unit | shared |
Source: Quota costs for API requests (page last updated 2026-10-15, read 2026-10-29). The separate upload bucket dates from 2026-06-01; before 2025-12-04 an upload cost about 1600 units (revision history).
Failure modes
| Output | Cause | Fix |
|---|---|---|
no_client_secrets |
YOUTUBE_CLIENT_SECRETS unset or not a file |
REFERENCE.md § One-time OAuth setup |
no_token |
auth never run, or the refresh token expired |
Run auth. An OAuth app left in "Testing" status gets refresh tokens that expire after 7 days |
http_403: forbidden on thumbnails.set |
Custom thumbnails need a verified YouTube account | Verify the account in YouTube, then retry thumbnail |
http_403: quotaExceeded |
Daily quota spent | Wait for the reset at midnight Pacific Time |
http_400: uploadLimitExceeded |
The channel has hit its own upload limit | Wait; this is a channel limit, not API quota |
video_not_found |
Wrong id, or the token's channel does not own it | Run whoami |
API facts, field limits and the OAuth setup steps: REFERENCE.md.
04 同仓库更多 Skills
session-workflow-capture
Workflow-tool scripts and workflow friction from this session, filed as issues here or in the plugins repo. Use when a session ran Workflow scripts.
kitty-show-image
Show the user an image with a note on what to judge, via a file send or a labelled kitty tab. Use when the user must see an image, or icat fails with no /dev/tty.
kitty-session-persistence
Snapshot and restore kitty terminal sessions on macOS. Use when surviving WindowServer hangs without losing tabs, configuring snapshots, or restoring after a force-reboot.
kitty-remote-control
Safe kitty remote control from an agent — read panes with kitty @ ls/get-text, notify, and never mutate the live terminal unasked. Use when running inside kitty.
docs-reference-check
Dangling doc-reference gate: flag markdown naming repo paths or relative links that no longer exist. Use when docs cite moved/deleted files, or wiring a doc-drift lint.
YouTube 私密视频组织共享
youtube-studio-share
通过在浏览器中编写脚本操作 YouTube Studio,将私密 YouTube 视频分享给整个 Google Workspace 组织。适用于视频必须仅限组织内部可见的场景。