Direct context workflow
Run the bundled executable for stateless YouTube search and extraction. It sends requests from the user's machine directly to YouTube and requires no video2ctx account, API key, hosted service, or npm installation.
Run an operation
Resolve scripts/youtube.mjs relative to the parent skill directory containing SKILL.md, then invoke it with Node.js. Use its absolute path when the user's working directory is elsewhere.
node <skill-directory>/scripts/youtube.mjs --helpSearch before extraction when the user supplied a topic rather than a known resource ID:
node <skill-directory>/scripts/youtube.mjs search \
--query "agent skills" \
--type video \
--captions-onlyExtract a transcript from a known video:
node <skill-directory>/scripts/youtube.mjs transcript \
--video-id dQw4w9WgXcQ \
--format textUse --format text when the task needs transcript content or a summary rather than timestamps. Use --format segments for segment timing and --format words only for word-level timing. The legacy --granularity segment|word flag remains supported, but do not combine it with --format.
The executable writes one JSON value to stdout. Parse that value and use it to answer the request. Treat stderr as a JSON error payload and inspect error.message alongside error.code and error.retryable; preserve the classified failure instead of converting it to an empty result. For blocked network requests, follow the parent skill's network-failure guidance before switching to the hosted fallback.
Choose the operation
search— videos, channels, or playlists matching a querytracks— source caption tracks and translation targetstranscript— compact text, timed segments, or timed wordscomments— one page, or a bounded multi-page collection with--all --max-pages <n>details— video metadata and availabilityendscreen— interactive end-screen elementschannel-info— channel identity and public About informationchannel-videos— one Videos-tab pagechannel-playlists— one Playlists-tab pageplaylist— playlist metadata and one video page
Use --help as the source of truth for flags and accepted values.
Bound and verify
- Give pagination an explicit request or page budget. Reuse a continuation only with the same operation and query that produced it.
- Inspect
meta.partialandmeta.warningswhenever the returned resource provides them and the answer implies completeness.endscreenreturns an array withoutmeta. - Call
tracksfirst when transcript success depends on a particular source or translation language. - Use
OUTBOUND_PROXY_URLfor an HTTP(S) proxy when the user's network requires one. Prefer the environment variable over--proxyso credentials do not appear in the process list. - Expect YouTube's undocumented response shapes and client profiles to change. Report classified upstream failures accurately.
Completion criteria
The requested local operation completed within an explicit pagination budget; JSON output was parsed; partial-result warnings were reflected where relevant; and any failure retained its error code and retryability.