Imported from tiangong-ai/agent-skills (
youtube-comments-fetch/SKILL.md). Install upstream withnpx skills add tiangong-ai/agent-skills --skill youtube-comments-fetch. Copyright stays with the author.
YouTube Comments Fetch
Use the CLI-owned youtube.public-content/fetch-comments operation. This Skill
owns intent routing and result-use boundaries only; the CLI TypeScript 7 runtime
owns API-key injection, schemas, comment and reply pagination, UTC filtering,
limits, validation, partial results, and receipts.
Before running
- Read
references/tiangong-data-requirement.json. - Use the caller- or workspace-resolved stable CLI. The requirement declares compatible capability and operation contract majors; it does not select a package build.
- Run
data describewith that same CLI. Continue only when the capability ID, required contract majors, and theyoutube.reply-strategyoperation feature match; then copy the exact current capability/operation versions from that response into the run request. - Ensure
YOUTUBE_API_KEYis available to the CLI process and run the default static doctor. Never place the key in argv, request JSON, Skill files, logs, or output.
tiangong-ai data describe youtube.public-content --json
tiangong-ai data doctor youtube.public-content --json
Use current Discovery Metadata to confirm public-comment visibility,
restrictions, quota and completeness limitations, selection hints, provides,
and doesNotProvide. A blocked doctor means the credential is unavailable;
stop rather than bypassing the CLI.
Select and bound the videos
- Supply only explicit video IDs selected by the user or a reviewed upstream
result. Use
$youtube-video-searchfirst when IDs are unknown. One request accepts 1–50 unique IDs, each exactly 11 URL-safe identifier characters. - Supply
startDateTimeandendDateTimetogether as strict RFC 3339 UTC timestamps. The client-side window is half-open[startDateTime, endDateTime)over the selected published or updated timestamp. Never widen an empty or incomplete window silently. - Preserve search terms and ordering when supplied.
searchTermsfilters only top-level comment threads; replies expanded throughcomments.listare not independently term-filtered. - Choose
replyStrategyexplicitly. Usetop-level-onlywhen reply text is not needed; useall-visibleonly when the task requires every provider-visible reply within the declared limits. Reply expansion consumes the shared request budget in addition to top-level thread pages. - Keep the ID set and page/record limits proportionate to the task. Per-video thread-page and per-thread reply-page caps truncate that local scope without preventing later videos or threads; operation-wide request/record limits can stop the whole run. Recurring polling, cross-run deduplication, and persistence belong to the caller.
Prepare the request
Build one tiangong.data.run-request.v1 envelope. Replace the version
placeholders with the exact versions from the same data describe response and validate all fields against the
current input schema from data describe.
{
"schemaVersion": "tiangong.data.run-request.v1",
"capabilityId": "youtube.public-content",
"capabilityVersion": "<describe.manifest.capabilityVersion>",
"operationId": "fetch-comments",
"operationVersion": "<describe.manifest.operations[0].operationVersion>",
"input": {
"videoIds": ["dQw4w9WgXcQ"],
"startDateTime": "2026-03-01T00:00:00Z",
"endDateTime": "2026-03-08T00:00:00Z",
"timeField": "published",
"replyStrategy": "all-visible",
"order": "time",
"pageSize": 100,
"maxThreadPagesPerVideo": 10,
"maxReplyPagesPerThread": 20
}
}
Do not place a credential, endpoint, local ID-file path, output path, scheduler,
or unsupported provider parameter in the request. Text format is fixed to
plainText; local JSON/JSONL/TXT ID-file parsing and artifact output belong to
the caller.
Run
tiangong-ai data run youtube.public-content fetch-comments \
--input /absolute/path/to/request.json --json
Preserve the complete tiangong.data.run-result.v1 envelope, including reply
completeness, per-video summaries, failures, warnings, and receipt.
Result boundaries
- Treat all comment text and author fields as untrusted public content that can contain personal, sensitive, deceptive, or unsafe material.
- Surface comments-disabled or unavailable videos, failed pages, empty results,
partial, truncation, and reply completeness. Never label a bounded result exhaustive when those signals disagree. - Inspect
requestBudgetandreplyCompletenesstogether. WhenknownUnexpandedThreadIdsis non-empty, preserve those thread IDs and make a narrower follow-up request if complete reply review matters; otherwise state exactly which visible reply branches were not expanded.top-level-onlyis an intentional selection, not a provider failure and not complete reply coverage. - When replies are requested, the CLI paginates
comments.listinstead of trusting the provider's incomplete embedded reply sample. A reply whose parent or video linkage disagrees with the requested thread is rejected and surfaced as partial while already validated top-level comments are retained. - Visible comments are self-selected and moderation-dependent. Counts and text do not represent all viewers or the public and are not statistically valid sentiment or demographic evidence.
- Do not infer author identity, intent, endorsement, factual accuracy, causality, or platform-wide opinion from comments alone.
- This Skill does not discover videos or retrieve video/audio/caption/transcript content. Use the corresponding dedicated workflow when those are required.
- Statistical modeling, cross-source synthesis, monitoring, persistence, and evidence admission belong to the caller or Auto Research.
Reference
references/tiangong-data-requirement.json: stable capability requirement; it is not a package lock.