# Youtube Comments Fetch

> Fetch bounded visible public YouTube top-level comments and optional complete-within-limits replies for explicit video IDs through the Tiangong CLI. Use after selecting videos when a task needs public discussion text; do not use for video discovery, private or moderation data, unbounded harvesting, representative opinion, identity or fact verification, demographic inference, or sentiment ground truth.

- Skill: `tiangong-ai/youtube-comments-fetch` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds add tiangong-ai/youtube-comments-fetch`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tiangong-ai/youtube-comments-fetch/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: tiangong-ai (https://skillmd.com/u/tiangong-ai)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/tiangong-ai/youtube-comments-fetch

---


# 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

1. Read `references/tiangong-data-requirement.json`.
2. Use the caller- or workspace-resolved stable CLI. The requirement declares
   compatible capability and operation contract majors; it does not select a
   package build.
3. Run `data describe` with that same CLI. Continue only when the capability
   ID, required contract majors, and the `youtube.reply-strategy` operation
   feature match; then copy the exact current
   capability/operation versions from that response into the run request.
4. Ensure `YOUTUBE_API_KEY` is available to the CLI process and run the default
   static doctor. Never place the key in argv, request JSON, Skill files, logs,
   or output.

```bash
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-search` first when IDs are unknown. One request
  accepts 1–50 unique IDs, each exactly 11 URL-safe identifier characters.
- Supply `startDateTime` and `endDateTime` together 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. `searchTerms` filters only
  top-level comment threads; replies expanded through `comments.list` are not
  independently term-filtered.
- Choose `replyStrategy` explicitly. Use `top-level-only` when reply text is not
  needed; use `all-visible` only 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`.

```json
{
  "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

```bash
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 `requestBudget` and `replyCompleteness` together. When
  `knownUnexpandedThreadIds` is 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-only` is
  an intentional selection, not a provider failure and not complete reply
  coverage.
- When replies are requested, the CLI paginates `comments.list` instead 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.

