关于
用于自动化 YouTube 工作流的 CLI、MCP 服务器和 AI 智能体
人工智能与机器学习实测星标增长
- 24小时
- +2
- 7天
- +4
- 15天
- +15
- 1个月
- +32
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README_zh.md
原文yutu
yutu 是一个用于自动化 YouTube 工作流程的 CLI、MCP 服务器和 AI Agent——从上传和优化视频到管理评论、播放列表和频道品牌——并提供面向 AI Agent 的 Skill,帮助您获得更多播放量、更高的点击率和更强的观众互动,同时大幅减少手动操作。
目录
前提条件
开始之前,您需要在 Google Cloud Platform 上创建一个账户来新建项目,并为该项目启用以下 API,位置在 APIs & Services -> Enable APIs and services -> + ENABLE APIS AND SERVICES:
启用 API 后,创建一个 OAuth consent screen,将您自己设置为测试用户,然后创建一个类型为 Desktop app 的 OAuth Client ID。
将此凭据下载到本地机器,命名为 client_secret.json,它应该看起来像这样:
{
"installed": {
"client_id": "11181119.apps.googleusercontent.com",
"project_id": "yutu-11181119",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "XXXXXXXXXXXXXXXX",
"redirect_uris": ["http://localhost"]
}
}
要验证此凭据,请运行以下命令:
❯ yutu auth --credential client_secret.json
浏览器窗口将打开,要求您授权访问您的 YouTube 账户。授权后,将生成一个令牌并保存到 youtube.token.json。
{
"access_token": "ya29.XXXXXXXXX",
"token_type": "Bearer",
"refresh_token": "1//XXXXXXXXXX",
"expiry": "2024-05-26T18:49:56.1911165+08:00",
"expires_in": 3599
}
默认情况下,yutu 将从当前目录读取 client_secret.json 和 youtube.token.json,--credential/-c 和 --cacheToken/-t 标志仅在 auth 子命令中可用。要在所有子命令中修改默认路径,请设置这些环境变量:
❯ export YUTU_CREDENTIAL=client_secret.json
❯ export YUTU_CACHE_TOKEN=youtube.token.json
# 或
❯ YUTU_CREDENTIAL=client_secret.json YUTU_CACHE_TOKEN=youtube.token.json yutu subcommand --flag value
全局环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
YUTU_CREDENTIAL |
OAuth 客户端密钥的路径、Base64 或 JSON | client_secret.json |
YUTU_CACHE_TOKEN |
缓存的 OAuth 令牌的路径、Base64 或 JSON | youtube.token.json |
YUTU_ROOT |
文件解析的根目录 | 当前工作目录 |
YUTU_LOG_LEVEL |
日志级别:DEBUG、INFO、WARN、ERROR |
INFO |
安装
如果您正在使用 AI Agent,可以复制以下提示词来完成安装:
Install and configure yutu by following https://raw.githubusercontent.com/eat-pray-ai/yutu/main/internal/tools/skillgen/setup.md
您可以直接从发布页面下载 yutu,或使用以下您喜欢的方法。
GitHub Actions
yutu 有两个可用的 GitHub Action,一个是通用 action,另一个专用于上传视频到 YouTube。更多信息请参考 youtube-action 和 youtube-uploader。
Node.js
❯ npm i -g @eat-pray-ai/yutu
Docker
# GitHub Container Registry (GHCR)
❯ docker pull ghcr.io/eat-pray-ai/yutu:latest
# 或 Docker Hub
❯ docker pull eatprayai/yutu:latest
❯ docker run --rm ghcr.io/eat-pray-ai/yutu:latest
# 确保 client_secret.json 在当前目录中
❯ docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/app -p 8216:8216 ghcr.io/eat-pray-ai/yutu:latest
Gopher
❯ go install github.com/eat-pray-ai/yutu@latest
# 启用 Agent
❯ go install -tags agent github.com/eat-pray-ai/yutu@latest
Linux
❯ curl -sSfL https://raw.githubusercontent.com/eat-pray-ai/yutu/main/scripts/install.sh | bash
macOS
使用 Homebrew🍺 安装 yutu(推荐),或运行 shell 脚本。
❯ brew install yutu
# 或
❯ curl -sSfL https://raw.githubusercontent.com/eat-pray-ai/yutu/main/scripts/install.sh | bash
Windows
❯ winget install yutu
验证安装
使用其关联的加密签名证明来验证 yutu 的完整性和来源。
# Docker
❯ gh attestation verify oci://ghcr.io/eat-pray-ai/yutu:latest --repo eat-pray-ai/yutu
❯ gh attestation verify oci://docker.io/eatprayai/yutu:latest --repo eat-pray-ai/yutu
# Linux 和 macOS(如果使用 shell 脚本安装)
❯ gh attestation verify $(which yutu) --repo eat-pray-ai/yutu
# Windows
❯ gh attestation verify $(where.exe yutu.exe) --repo eat-pray-ai/yutu
Agent
yutu 提供了 Agent 模式(Miffy)来自动化 YouTube 工作流程。该 Agent 可以检索、创建、更新和删除 YouTube 内容,内置 YouTube 增长策略和 SEO 专业知识。
[!NOTE] Agent 模式默认通过
agent构建标签(build tag)隔离,预编译及默认构建仅包含 CLI 和 MCP。如需启用 Agent 支持,请使用-tags agent安装或构建:
go install -tags agent github.com/eat-pray-ai/yutu@latest或go build -tags agent
# Gemini(兼容)(默认)
❯ yutu agent --provider google --model gemini-4-hydrogen --apiKey "YOUR_KEY"
❯ yutu agent --provider google --model gemini-4-carbon --apiKey "YOUR_KEY" --baseUrl "https://custom.endpoint.com"
# OpenAI(兼容)(OpenAI、DeepSeek、Ollama、vLLM 等)
❯ yutu agent --provider openai --model gpt-6-astra --apiKey "YOUR_KEY"
❯ yutu agent --provider openai --model deepseek-flash --apiKey "YOUR_KEY" --baseUrl "https://api.deepseek.com"
# Anthropic(兼容)
❯ yutu agent --provider anthropic --model claude-fable-5-2 --apiKey "YOUR_KEY"
❯ yutu agent --provider anthropic --model claude-opus-5-5 --apiKey "YOUR_KEY" --baseUrl "https://custom.endpoint.com"
# Web 模式
❯ yutu agent --args "web api a2a webui" --apiKey "YOUR_KEY"
# 查看可用的启动参数
❯ yutu agent --args ""
Agent 参数
| 参数 | 描述 | 默认值 |
|---|---|---|
-a, --args |
启动参数(单个字符串) | console |
-p, --provider |
LLM 提供商:google、openai 或 anthropic |
google |
-m, --model |
模型名称 | gemini-4-hydrogen |
--apiKey |
模型提供商的 API 密钥 | |
--baseUrl |
模型提供商的 API 端点地址 | |
-i, --instruction |
覆盖内置的 Agent 指令 | INSTRUCTION.md |
MCP 服务器
在将 yutu 用作 MCP 服务器之前,请确保已安装 yutu(参见安装部分),并且您有有效的 client_secret.json 和 youtube.token.json 文件(参考前提条件部分)。
使用以下命令为一个或多个 AI Agent 配置全局 MCP:
❯ yutu mcp setup --agents claude,opencode,pi,codex \
--credential /absolute/path/to/client_secret.json \
--cacheToken /absolute/path/to/youtube.token.json
--agents 为必填项。凭据和令牌参数支持文件路径、Base64 或 JSON;省略时使用对应的环境变量或默认文件路径。相对路径会转换为绝对路径。建议使用文件路径,避免将内联密钥复制到 Agent 配置中。
Skills
yutu 提供了一个统一的 skill,为 AI Agent 扩展 YouTube 领域知识、常用工作流和 SEO 最佳实践——涵盖视频、播放列表、评论、频道、字幕、订阅等。
❯ npx skills add eat-pray-ai/yutu --skill youtube-automation
完整的支持操作列表请参见 skills/youtube-automation/SKILL.md。
使用方法
❯ yutu
yutu is a CLI, MCP server, and AI Agent that automates your YouTube workflows from the terminal or any AI Agent.
Environment variables:
YUTU_CREDENTIAL Path/Base64/JSON of OAuth client secret (default: client_secret.json)
YUTU_CACHE_TOKEN Path/Base64/JSON of cached OAuth token (default: youtube.token.json)
YUTU_ROOT Root directory for file resolution (default: current working directory)
YUTU_LOG_LEVEL Log level: DEBUG, INFO, WARN, ERROR (default: INFO)
Usage:
yutu [flags]
yutu [command]
Available Commands:
abuseReport Manage YouTube abuse reports
activity Manage YouTube activities
agent Start an Agent to automate YouTube workflows
auth Authenticate with YouTube APIs
caption Manage YouTube video captions
channel Manage YouTube channels
channelBanner Manage YouTube channel banners
channelSection Manage YouTube channel sections
comment Manage YouTube comments
commentThread Manage YouTube comment threads
completion Generate the autocompletion script for the specified shell
help Help about any command
i18nLanguage Manage YouTube i18n languages
i18nRegion Manage YouTube i18n regions
liveBroadcast Manage YouTube live broadcasts
liveChatBan Manage YouTube live chat bans
liveChatMessage Manage YouTube live chat messages
liveChatModerator Manage YouTube live chat moderators
liveStream Manage YouTube live streams
mcp Start MCP server
member Manage YouTube channel members
membershipsLevel Manage YouTube membership levels
playlist Manage YouTube playlists
playlistImage Manage YouTube playlist images
playlistItem Manage YouTube playlist items
search Manage YouTube search
subscription Manage YouTube subscriptions
superChatEvent Manage YouTube Super Chat events
thirdPartyLink Manage YouTube third-party links
thumbnail Manage YouTube video thumbnails
version Show the version of yutu
video Manage YouTube videos
videoAbuseReportReason Manage YouTube video abuse report reasons
videoCategory Manage YouTube video categories
videoTrainability Manage YouTube video trainability
watermark Manage YouTube watermarks
Flags:
-h, --help help for yutu
Use "yutu [command] --help" for more information about a command.
功能特性
请参考 FEATURES.md 获取更多信息。
赞助
如果 yutu 帮你节省了时间,欢迎在 GitHub 上点个 ⭐ Star,让更多人发现这个项目。
你也可以通过捐赠(支付宝 / 微信)支持项目开发,详见 yutu.ifor.dev。感谢你的支持!💖
贡献
请参考 CONTRIBUTING.md 获取更多信息。
探索相关项目
加载中…
