YouTube Video API Skill
📖 Introduction
This skill provides users with a one-stop YouTube video data extraction service using BrowserAct's YouTube Video API template. It can directly extract structured channel-level data plus video detail data from a specific YouTube channel through a single API request. Just input the YouTube channel URL and video type (Latest, Popular, or Earliest), and you can get clean, ready-to-use video metrics.
✨ Features
- 1. No hallucinations, ensuring stable and accurate data extraction: Pre-set workflows avoid generative AI hallucinations.
- No CAPTCHA issues: No need to handle reCAPTCHA or other verification challenges.
- No IP access restrictions and geo-blocking: No need to deal with regional IP restrictions.
- More agile execution speed: Compared to pure AI-driven browser automation solutions, task execution is faster.
- Extremely high cost-effectiveness: Significantly reduces data acquisition costs compared to AI solutions that consume a large number of Tokens.
🔑 API Key Guidance Flow
Before running, you must check the
BROWSERACT_API_KEY environment variable. If it is not set, do not take any other actions first. You should request and wait for the user to provide it collaboratively.
The Agent must inform the user at this time:
"Since you have not configured the BrowserAct API Key yet, please go to the BrowserAct Console first to get your Key."
🛠️ Input Parameters
When calling the script, the Agent should flexibly configure the following parameters based on user needs:
- 1. YouTubechannelurl
-
Type:
string
-
Description: Target YouTube channel URL used to load the channel video list.
-
Example: INLINECODE2
- 2. Video_type
-
Type:
string
-
Description: Which ordering mode to use when traversing the channel video list.
-
Optional Values:
-
Latest
-
Popular
-
Earliest
-
Default: INLINECODE7
🚀 Invocation Method
The Agent should implement "one command gets results" by executing the following independent script:
CODEBLOCK0
⏳ Running Status Monitoring
Since this task involves automated browser operations, it may take a long time (several minutes). The script will
continuously output status logs with timestamps (e.g.,
[14:30:05] Task Status: running) while running.
Agent Instructions:
- - While waiting for the script to return results, please keep an eye on the terminal output.
- As long as the terminal is still outputting new status logs, it means the task is running normally. Do not misjudge it as a deadlock or unresponsiveness.
- If the status remains unchanged for a long time or the script stops outputting and no result is returned, the retry mechanism can be considered.
📊 Data Output Description
After successful execution, the script will parse and print the results directly from the API response. The results include:
Channel fields
- -
channel_title: Channel name displayed on the channel page - INLINECODE10 : Channel URL
- INLINECODE11 : Subscriber count shown on the channel page
Video fields
- -
video_title: Video title shown on the video page - INLINECODE13 : Video URL
- INLINECODE14 : Published date or time shown on YouTube
- INLINECODE15 : View count shown on YouTube
- INLINECODE16 : Video duration
- INLINECODE17 : Total number of comments (if available)
- INLINECODE18 : Like count (if available)
⚠️ Error Handling & Retry
During script execution, if an error occurs (such as network fluctuation or task failure), the Agent should follow the logic below:
- 1. Check the output content:
- If the output
contains "Invalid authorization", it means the API Key is invalid or expired. At this time,
do not retry, but guide the user to recheck and provide the correct API Key.
- If the output
does not contain "Invalid authorization" but the task execution fails (for example, the output starts with
Error: or the return result is empty), the Agent should
automatically try to execute the script once more.
- 2. Retry limits:
- Automatic retry is limited to
once. If the second attempt still fails, stop retrying and report the specific error information to the user.
🌟 Typical Use Cases
- 1. Competitor Tracking: Track performance trends and posting cadence of a competitor's channel.
- Creator Research: Analyze engagement signals and popular videos of content creators.
- Content Ops Reporting: Monitor channel videos and performance metrics for reporting.
- Growth Analytics: Understand what video types (Latest/Popular) drive growth.
- Database Automation: Send channel videos directly into CRM or databases without manual export.
- Market Research: Aggregate video metrics across different channels in a specific industry.
- Trend Spotting: Identify the most popular videos on specific tech or gaming channels.
- Audience Engagement Analysis: Correlate subscriber counts with video views and likes.
- Content Strategy: Review a channel's earliest videos to understand their origin and growth path.
- Automated Social Monitoring: Keep tabs on new content released by key industry leaders.
YouTube 视频 API 技能
📖 简介
本技能利用 BrowserAct 的 YouTube 视频 API 模板,为用户提供一站式 YouTube 视频数据提取服务。通过一次 API 请求,即可直接从特定 YouTube 频道提取结构化的频道级数据以及视频详细信息。只需输入 YouTube 频道 URL 和视频类型(最新、最热门或最早),即可获得干净、可直接使用的视频指标数据。
✨ 功能特点
- 1. 无幻觉,确保数据提取稳定准确:预设工作流程避免了生成式 AI 的幻觉问题。
- 无验证码问题:无需处理 reCAPTCHA 或其他验证挑战。
- 无 IP 访问限制和地域封锁:无需处理区域 IP 限制问题。
- 执行速度更敏捷:与纯 AI 驱动的浏览器自动化解决方案相比,任务执行速度更快。
- 极高的性价比:与消耗大量 Token 的 AI 解决方案相比,显著降低了数据获取成本。
🔑 API 密钥引导流程
运行前,必须检查 BROWSERACT
APIKEY 环境变量。如果未设置,请先不要执行任何其他操作。应请求并等待用户协作提供。
此时 Agent 必须告知用户:
由于您尚未配置 BrowserAct API 密钥,请先前往 BrowserAct 控制台 获取您的密钥。
🛠️ 输入参数
调用脚本时,Agent 应根据用户需求灵活配置以下参数:
- 1. YouTubechannelurl
-
类型:string
-
描述:目标 YouTube 频道 URL,用于加载频道视频列表。
-
示例:https://www.youtube.com/@BrowserAct
- 2. Video_type
-
类型:string
-
描述:遍历频道视频列表时使用的排序模式。
-
可选值:
- Latest(最新)
- Popular(最热门)
- Earliest(最早)
-
默认值:Popular
🚀 调用方法
Agent 应通过执行以下独立脚本实现一键获取结果:
bash
调用示例
python -u ./scripts/youtube
videoapi.py YouTube
channelurl Video_type
⏳ 运行状态监控
由于此任务涉及自动化浏览器操作,可能需要较长时间(数分钟)。脚本在运行时会
持续输出带时间戳的状态日志(例如 [14:30:05] 任务状态:运行中)。
Agent 操作说明:
- - 在等待脚本返回结果期间,请密切关注终端输出。
- 只要终端仍在输出新的状态日志,即表示任务正常运行。请勿误判为死锁或无响应。
- 如果状态长时间未变化,或脚本停止输出且未返回结果,可考虑使用重试机制。
📊 数据输出说明
执行成功后,脚本将直接从 API 响应中解析并打印结果。结果包括:
频道字段
- - channeltitle:频道页面上显示的频道名称
- channelurl:频道 URL
- subscribers:频道页面上显示的订阅者数量
视频字段
- - videotitle:视频页面上显示的视频标题
- videourl:视频 URL
- publishdate:YouTube 上显示的发布日期或时间
- viewcount:YouTube 上显示的观看次数
- videoduration:视频时长
- commentcount:评论总数(如有)
- like_count:点赞数(如有)
⚠️ 错误处理与重试
在脚本执行过程中,如果发生错误(如网络波动或任务失败),Agent 应遵循以下逻辑:
- 1. 检查输出内容:
- 如果输出
包含 Invalid authorization,则表示 API 密钥无效或已过期。此时
不要重试,而应引导用户重新检查并提供正确的 API 密钥。
- 如果输出
不包含 Invalid authorization 但任务执行失败(例如输出以 Error: 开头或返回结果为空),Agent 应
自动尝试再次执行脚本。
- 2. 重试限制:
- 自动重试限制为
一次。如果第二次尝试仍然失败,则停止重试并向用户报告具体的错误信息。
🌟 典型使用场景
- 1. 竞争对手追踪:追踪竞争对手频道的表现趋势和发布节奏。
- 创作者研究:分析内容创作者的互动信号和热门视频。
- 内容运营报告:监控频道视频和表现指标,用于报告生成。
- 增长分析:了解哪些视频类型(最新/最热门)推动了增长。
- 数据库自动化:无需手动导出,直接将频道视频发送到 CRM 或数据库中。
- 市场调研:汇总特定行业不同频道的视频指标数据。
- 趋势发现:识别特定科技或游戏频道上最热门的视频。
- 受众互动分析:关联订阅者数量与视频观看次数和点赞数。
- 内容策略:查看频道最早期的视频,了解其起源和发展路径。
- 自动化社交监控:密切关注关键行业领袖发布的新内容。