# YouTube Account Assistant — AI Comment Manager & Safe Outreach (`tubetext/youtube-account-assistant`) Actor

AI comment manager for your own YouTube channel: spam auto-moderation, questions answered from your product profile, golden-hour replies, safe niche outreach and lead mining. Official API, you authorize with your own Google project. $0.02 per posted comment; failed actions free. · by TubeText

- **URL**: https://apify.com/tubetext/youtube-account-assistant.md
- **Developed by:** [TubeText Labs](https://apify.com/tubetext) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Account Assistant — AI 评论管家 & 安全互动

> **TubeText** · YouTube 官方 API · Pay per event. 无需我们代登录。Ready for AI agents. [All tools](https://apify.com/tubetext)

把你自己的 YouTube 频道交给 AI 管理：**垃圾评论自动隐藏、观众提问按你的产品资料回复、发布后黄金时段自动互动、去同行视频下安全引流**。全程走 YouTube 官方 API，你用自己的 Google 项目授权，我们不经手你的密码。每条评论 $0.003 起。

### Quick start（三步开始）

1. **授权你自己的频道（一次性，约 10 分钟）**——见下方 [首次授权](#connect-an-account)。
2. 表单里选 `mode = inspect` 跑一次，确认显示你的频道 ID。
3. 选 `mode = execute`，在 Operations 里填第一条操作（比如 [评论管家](#daily-comment-butler)），点 Start。

**Cost:** $0.01 启动 + $0.02/条发布 + $0.0005/条分诊。失败链接免费。更高 Apify 档位自动打折。

### 它能帮你做的 5 件事（每件都是现成操作）

#### 1. 每日评论管家 `manage_comments`

自动收新评论 → AI 一次批量分类（垃圾/提问/好评/负评/其他）→ 按你的策略处理：垃圾自动进审核或拒绝、提问 AI 按你的产品资料回复、对观众的追问自动跟进——**已处理的评论永远不重复处理**。

```json
{
  "mode": "execute",
  "expectedChannelId": "UC你的频道ID",
  "autoPost": true,
  "operations": [{
    "operationId": "daily-1", "action": "manage_comments",
    "videoId": "你的视频ID", "publishedAfterHours": 24,
    "policy": { "spam": "hold", "replyScope": "questions", "autoPost": true, "maxReplies": 10 }
  }]
}
```

真实运行样例（测试频道）：扫描 3 条评论 → AI 分类为垃圾 1、提问 1、好评 1 → 垃圾自动隐藏、提问已回复：

```json
{"status":"succeeded","triage":{"spamHandled":[{"commentId":"t2","action":"heldForReview"}],"replies":[{"commentId":"t1","replyText":"Thanks for the heads up, we'll keep our paws on this one! 喵~"}]}}
```

配 `strategyName` 或定时任务，每天自动只处理新评论。

#### 2. 黄金时段自动互动 `watch_comments`

运营共识：发布后 1–2 小时的回复最能带动算法。发布新视频后启动一次：

```json
{ "operationId": "watch-1", "action": "watch_comments", "videoId": "新视频ID",
  "watchMinutes": 60, "watchIntervalMinutes": 5,
  "policy": { "replyScope": "all", "autoPost": true, "maxReplies": 20 } }
```

每小时增量处理新评论并按你的语气回复，直到窗口结束。

#### 3. 营销互动 `marketing_engage`（去别人的视频下安全引流）

三档范围任选：**关键词**（自动搜相关视频）/ **指定频道**（盯竞对的新视频）/ **不限制**（AI 根据你的产品自动定方向）。四种互动模式：

| 模式 | 效果 | 示例（真实草稿）| AI |
|---|---|---|---|
| `rule` 规则 | 模版自动回复热门评论，零 AI 成本 | "Template A for..."（你的模版）| 否 |
| `fun` 趣味 | 俏皮接梗拉好感 | "That would be a legendary prank! 😂" | 是 |
| `soft_ad` 软广 | 先给价值，自然带出产品 | "For tracking reviews across 12 stores, a shared dashboard saved us hours" | 是 |
| `hard_ad` 硬广 | 直接推荐产品+核心卖点（默认关闭）| "我们用 X 管理了 12 家店…" | 是 |

护栏内建：每视频冷却 7 天不重复触达、每轮总量上限、排除名单、**默认只出草稿**，`autoPost: true` 才真发。

#### 4. 竞对评论区挖线索 `mine_leads`

搜竞对/关键词视频的评论区，AI 按**购买意向和痛点**给评论者打分，输出线索清单（含建议接触角度）——发现权归你，怎么跟进你决定。

```json
{ "operationId": "leads-1", "action": "mine_leads",
  "queries": ["store review management"], "maxVideos": 3,
  "criteria": "多店运营者、明确表达管理痛点" }
```

#### 5. 大规模营销活动 `run_campaign`（上万级评论）

一条命令跑完整漏斗：**种子词 → AI 自动扩词 → 发现博主 → 增量采集评论（已看过的永不重读）→ AI 批量分诊 → 按配比分配互动 → 节奏发布**。

```json
{ "action": "run_campaign", "campaignId": "pets-niche",
  "seedKeywords": ["猫咪", "萌宠", "铲屎官"], "expandTo": 8,
  "creatorsPerRun": 3, "videosPerCreator": 1, "commentsPerVideo": 30,
  "maxTotal": 100, "modeMix": { "fun": 70, "soft": 20, "rule": 10 },
  "productProfile": "你的产品资料…", "autoPost": true }
```

真实测试样例：3 个种子词 → AI 扩到 8 词 → 发现 3 个博主 → 采集 14 条评论 → 分诊后 5 条值得互动 → 输出 5 条趣味草稿。**每天定时跑一次，只处理"上次到现在"的新评论。**

#### 附加能力

- **`superfans`**：跨视频聚合最活跃的评论者，识别忠实粉丝和合作伙伴
- **`video_ideas`**：把评论区的需求变成视频选题（标题+角度+开场钩子）
- **`analyze_trends`**：AI 评论趋势报告（情绪分布、高频话题、值得你亲自关注的评论）
- **`export_interactions`**：导出全部互动台账（可按时间/类型过滤）
- **`moderation_queue`**：批量处理待审核队列（列出来 or AI 自动批准/拒绝）
- **需关注标记**：`flagForUser: true` + 标准（比如"合作需求、采购意向"）→ AI 把值得你亲自出面的评论单独列出来

### Quick start examples

### 首次授权（Connect an account）

用你**自己的** Google 云项目授权（自建自用豁免 Google 审核，无需 100 用户上限，配额也是你自己的：默认 1 万单位/天 ≈ 200 条评论 + 上千次读取）。

**第一步：建 Google 凭据（约 10 分钟）**

1. 打开 [console.cloud.google.com](https://console.cloud.google.com) → 新建项目
2. 启用 **YouTube Data API v3**
3. OAuth 同意屏幕 → 选 External → **点 Publish app 发布**（⚠️ 这步别漏：不发布的话授权 7 天就过期；自建自用发布无需 Google 审核）
4. 凭据 → 创建凭据 → OAuth 客户端 ID → 类型选**桌面应用** → 复制 Client ID 和 Client Secret

**第二步：表单跑两次授权**

1. `mode = authorize` + 填 `oauthClientId` → 运行 → Output 里出现授权链接
2. 浏览器打开链接（用你频道所在的 Google 账号登录）→ 允许 → 跳转到打不开的页面（预期）→ 复制地址栏完整 URL
3. `mode = authorize` + `authorizationResponse` 粘贴该 URL + `oauthClientSecret` → 运行 → 显示 **Connected**，完成

之后每次运行自动加载凭据，长期有效（除非你撤销）。支持 Gmail / Workspace / 任意 Google 账号；一个账号有多个频道时，授权页可直接选择。

### What you get per note — 每次运行的产出

- 每个操作的**独立凭据**（评论 ID、链接、状态），`succeeded`/`draft`/`unknown`/`failed` 明确标注
- 互动台账：全部回复、草稿、垃圾处置、需关注评论，随时导出
- AI 永不自行发布：草稿制，`autoPost` 由你决定
- 失败和跳过的操作**免费**

### Requirements & YouTube quota budgeting

- 读写走 YouTube 官方 API + 你授权的账号。**读很便宜**（100 条评论 = 1 配额单位），**写是 50 单位/条**——你的项目默认 1 万单位/天 ≈ 200 条评论 + 上千次读取。关键词搜索 100 单位/次，本工具带搜索预算并跨运行记住发现结果
- 我们无法绕过 YouTube 的任何限制：置顶评论、创作者爱心、编辑已发评论、私信均无官方 API
- AI 供应商说明：默认使用 OpenAI（gpt-4o-mini，草稿成本约 $0.001/次，已包含在事件价格里并有毛利）；不接受第三方 AI 供应商条款的话，核心评论操作可不依赖 AI

### Safety & platform rules 安全与平台规则

本工具是独立产品，与 YouTube/Google 无关联。通过官方 API 以你授权的账号执行操作**不代表所有自动化用途都被允许**：重复、未经请求或误导性的评论可能违反 YouTube 政策并导致内容或账号受限。请只操作你获授权的频道，理性选择目标与频率。工具内建的冷却、上限与草稿默认就是为此设计。

### 中文说明

**YouTube 频道 AI 评论管家**：授权自己的频道后，AI 自动分诊评论（垃圾自动隐藏、提问按你的产品资料回复、对观众追问自动跟进）、发布后黄金时段自动互动、去相关视频下安全引流（趣味/软广/硬广三种模式可选）、竞对评论区挖线索、跨视频识别超级粉丝、评论趋势分析。支持批量营销活动：种子词自动扩词→发现博主→采集评论→互动，已处理的评论永不重复处理。全程 YouTube 官方 API + 你自己的 Google 项目授权，无需我们代登录。每条评论发布 $0.02，分诊 $0.0005/条，失败免费。

### FAQ

**必须用 Gmail 吗？** 任何 Google 账号都可以（Gmail、Workspace 企业邮箱、非 Gmail 邮箱注册的 Google 账号）。一个账号管理多个频道（品牌账号）时，授权页可直接选择频道。

**会被封号吗？** 本工具全程走 YouTube 官方 API，用你自己的 Google 项目授权，无需第三方代登录。但自动化本身受 YouTube 政策约束：工具内建的冷却、上限、每视频一条的护栏就是为此设计。理性使用是用户的责任。

**AI 会乱发评论吗？** 不会。AI 只出草稿；`autoPost: true` 时才按你设定的策略发布，且每条发布都有凭据可查。AI 无法绕过你的策略、上限和冷却。

**垃圾评论能自动删除吗？** 能自动移入待审核或拒绝（YouTube 审核接口），也能只标记不动作——由你的 policy 决定。

**为什么不能置顶评论/点亮爱心/编辑已发评论/发私信？** 这些 YouTube 官方 API 均未开放，本工具不做无官方接口的模拟操作。

For help, [open an issue](https://apify.com/tubetext/youtube-account-assistant/issues) with the run ID and input. Never include credentials or tokens in issues. [More TubeText tools](https://apify.com/tubetext).

# Actor input Schema

## `mode` (type: `string`):

authorize = BYO-client OAuth setup (two runs). inspect = verify the connection. preview = validate without posting. execute = perform the operations.

## `oauthClientId` (type: `string`):

Your own Google Cloud project's OAuth client ID (mode=authorize).

## `oauthClientSecret` (type: `string`):

The matching client secret (mode=authorize, both runs).

## `oauthRedirectUri` (type: `string`):

Must match your OAuth client's registered redirect URI. Defaults to http://127.0.0.1/callback.

## `authorizationResponse` (type: `string`):

The full address-bar URL after approving the consent screen (mode=authorize, second run).

## `credentialClientId` (type: `string`):

Direct credentials if you already hold a refresh token. Stored channel credentials from mode=authorize load automatically.

## `credentialClientSecret` (type: `string`):

Direct credentials if you already hold a refresh token (client secret).

## `credentialRefreshToken` (type: `string`):

Direct credentials if you already hold a refresh token (refresh token).

## `connectionKey` (type: `string`):

Only for the hosted connection flow; takes precedence when set.

## `sampleChannelIds` (type: `array`):

Channel IDs for external monitoring samples. The Actor itself does not read this field.

## `expectedChannelId` (type: `string`):

UC… channel ID from inspect/authorize; prevents operating the wrong channel.

## `operations` (type: `array`):

Array of operations. Actions: upload, comment, reply, list_comments, ai_reply_own (AI drafts replies to your video's comments), ai_engage (AI drafts a comment on another video). Fields per action in the README. autoPost:true + mode:execute posts AI drafts; otherwise drafts are returned for review.

## `intervalSeconds` (type: `integer`):

Delay between operations (seconds)

## `googleProxyUrl` (type: `string`):

HTTP(S) proxy for Actor-side YouTube API requests.

## `action` (type: `string`):

Set to run_campaign for the full-funnel marketing engine (requires campaignId, seedKeywords, expectedChannelId). Leave empty for normal comment operations via mode + operations.

## `campaignId` (type: `string`):

Named marketing campaign. The seen-comment journal, creator pool and keyword pool are stored per campaignId and persist across runs.

## `seedKeywords` (type: `array`):

Niche seed words; AI expands them into related search keywords.

## `expandTo` (type: `integer`):

Campaign: expanded keyword pool size

## `maxTotal` (type: `integer`):

Campaign: max interactions per run

## `autoPost` (type: `boolean`):

When true, AI drafts and rule replies are posted automatically. When false, everything comes back as drafts for review.

## Actor input object example

```json
{
  "mode": "inspect",
  "sampleChannelIds": [
    "UCyrhHaUGPAqeRMlkNfn-a3Q"
  ],
  "expectedChannelId": "UCyrhHaUGPAqeRMlkNfn-a3Q",
  "intervalSeconds": 0,
  "expandTo": 20,
  "maxTotal": 100,
  "autoPost": false
}
```

# Actor output Schema

## `notes` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "inspect",
    "sampleChannelIds": [
        "UCyrhHaUGPAqeRMlkNfn-a3Q"
    ],
    "expectedChannelId": "UCyrhHaUGPAqeRMlkNfn-a3Q"
};

// Run the Actor and wait for it to finish
const run = await client.actor("tubetext/youtube-account-assistant").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "inspect",
    "sampleChannelIds": ["UCyrhHaUGPAqeRMlkNfn-a3Q"],
    "expectedChannelId": "UCyrhHaUGPAqeRMlkNfn-a3Q",
}

# Run the Actor and wait for it to finish
run = client.actor("tubetext/youtube-account-assistant").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "inspect",
  "sampleChannelIds": [
    "UCyrhHaUGPAqeRMlkNfn-a3Q"
  ],
  "expectedChannelId": "UCyrhHaUGPAqeRMlkNfn-a3Q"
}' |
apify call tubetext/youtube-account-assistant --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tubetext/youtube-account-assistant"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XXbj3amrcs8fC60Me/builds/WHaV06XXcthbHstQu/openapi.json
