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.
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."
When calling the script, the Agent should flexibly configure the following parameters based on user needs:
string
https://www.youtube.com/@BrowserAct
string
Latest
Popular
Earliest
Popular
The Agent should implement "one command gets results" by executing the following independent script:
# Invocation example
python -u ./scripts/youtube_video_api.py "YouTube_channel_url" "Video_type"
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:
After successful execution, the script will parse and print the results directly from the API response. The results include:
channel_title: Channel name displayed on the channel page
channel_url: Channel URL
subscribers: Subscriber count shown on the channel page
video_title: Video title shown on the video page
video_url: Video URL
publish_date: Published date or time shown on YouTube
view_count: View count shown on YouTube
video_duration: Video duration
comment_count: Total number of comments (if available)
like_count: Like count (if available)
During script execution, if an error occurs (such as network fluctuation or task failure), the Agent should follow the logic below:
"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.
"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 个版本