Skip to content

ericrisco/rsc-harness / skills/youtube-api

youtube-api

Verified

Use when wiring code to a real YouTube channel: user OAuth 2.0, resumable videos.insert uploads, editing metadata after publish, pulling views/watch time/retention/traffic from the Analytics API v2 into a dated 02-DOCS/wiki/youtube/ feedback log. NOT what to publish or how to title and thumbnail it (that is youtube-strategy / youtube-packaging).

FileKindSize
SKILL.mdskill md15.5 KB
evals/README.mdmarkdown894 B
evals/cases.yamlconfig3.7 KB
references/analytics-queries.mdmarkdown4.0 KB
references/oauth-setup.mdmarkdown3.7 KB
references/wiki-schema.mdmarkdown4.9 KB
scripts/verify.shexecutablescript3.6 KB

references/analytics-queries.md

View on GitHub
# Analytics API v2 — metric/dimension catalog + copy-paste queries

Every report is the same shape:

```text
GET https://youtubeanalytics.googleapis.com/v2/reports
  ?ids=channel==MINE
  &startDate=YYYY-MM-DD
  &endDate=YYYY-MM-DD
  &metrics=<comma list>
  &dimensions=<comma list>     (optional)
  &filters=<key==value;...>    (optional)
  &sort=<metric>               (optional)
  &maxResults=<n>              (optional)
```

`ids=channel==MINE` reports on the authenticated user's channel.

## Core metrics

| Metric | Meaning |
| --- | --- |
| `views` | view count |
| `estimatedMinutesWatched` | total watch time (minutes) |
| `averageViewDuration` | mean seconds watched per view |
| `averageViewPercentage` | mean % of the video watched |
| `subscribersGained` / `subscribersLost` | net subs movement |
| `likes`, `comments`, `shares` | engagement |
| `audienceWatchRatio` | absolute retention at a playback position |
| `relativeRetentionPerformance` | retention vs similar videos |
| `impressions`, `impressionClickThroughRate` | **content-owner-report metrics** — see CTR note |
| `estimatedRevenue` | needs `yt-analytics-monetary.readonly` scope |

## Useful dimensions

| Dimension | Use |
| --- | --- |
| `day` / `month` | time series |
| `video` | per-video breakdown |
| `elapsedVideoTimeRatio` | retention curve x-axis (0.0–1.0) |
| `insightTrafficSourceType` | where views come from |
| `country` | geography |
| `deviceType` | mobile/desktop/TV/tablet |
| `subscribedStatus` | `SUBSCRIBED` vs `UNSUBSCRIBED` |
| `ageGroup`, `gender` | demographics |

## Copy-paste query bodies (Python `yta.reports().query(...)`)

```python
# Daily time series for the month
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views,estimatedMinutesWatched,averageViewPercentage", dimensions="day")

# Top videos by views
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views,estimatedMinutesWatched,averageViewPercentage",
     dimensions="video", sort="-views", maxResults=10)

# Retention curve for one video
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="audienceWatchRatio,relativeRetentionPerformance",
     dimensions="elapsedVideoTimeRatio", filters="video==VIDEO_ID")

# Traffic sources
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views,estimatedMinutesWatched", dimensions="insightTrafficSourceType")

# Geography
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views,estimatedMinutesWatched", dimensions="country", sort="-views")

# Device + subscribed status
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views", dimensions="deviceType")
dict(ids="channel==MINE", startDate="2026-05-01", endDate="2026-05-31",
     metrics="views,averageViewPercentage", dimensions="subscribedStatus")
```

## `insightTrafficSourceType` values

`YT_SEARCH` (search), `SUGGESTED` (suggested videos), `BROWSE` (home/subscriptions feed), `EXT_URL` (external sites), `NOTIFICATION`, `PLAYLIST`, `END_SCREEN`, `NO_LINK_EMBEDDED`, `NO_LINK_OTHER`, `CHANNEL`, `SUBSCRIBER`.

## CTR / impressions: content-owner vs channel reports

`impressions` and `impressionClickThroughRate` are surfaced through **content-owner reports**, not reliably through a plain `channel==MINE` query. If a channel query returns empty for them, that is expected — do not treat it as an error and do not block the pull. Read the CTR value from YouTube Studio for the wiki entry instead. Everything else (views, watch time, retention, traffic) is available on the channel query.

## Valid combinations

Not every metric pairs with every dimension. `audienceWatchRatio` requires the `elapsedVideoTimeRatio` dimension and a single-`video` filter. Demographic dimensions (`ageGroup`, `gender`) only return percentage-style metrics (`viewerPercentage`), not raw `views`. When a combination is invalid the API returns a `400` naming the offending field — fix by aligning metric and dimension from the tables above.
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall