YouTube

get-video

youtube.com
InstallationInstalls just this skill for your agent
Side effectread
Authnone
Needsnavigate · evaluate
Summary

Fetch a YouTube video's details: title, channel, exact view count, length and description.

Params
{"videoId":"string (the 11-char video id, or a full youtube.com/watch?v= URL)"}
SKILL.md39 lines

Intent

Fetch one YouTube video's metadata. Navigates the watch page with hl=en and reads the embedded ytInitialPlayerResponse JSON that YouTube ships in the page (no API key needed). Param: videoId (the 11-char id, or a full watch URL, from which the extractor derives the id). Returns {videoId, title, channel, channelId, url, views (exact integer as string), lengthSeconds, publishDate, category, keywords, description}. Read-only.

Execute

  1. navigate → https://www.youtube.com/watch?v={{videoId}}&hl=en
  2. evaluate the Extractor below with params. It does the in-page work and returns the JSON in returns.

Extractor

( async (root, params) => { let id = String((params && params.videoId) || '').trim(); const m = id.match(/(?:v=|youtu.be/|/shorts/)([A-Za-z0-9_-]{11})/) || id.match(/^([A-Za-z0-9_-]{11})$/); if (m) id = m[1]; if (!/^[A-Za-z0-9_-]{11}$/.test(id)) throw new Error('missing or invalid videoId'); const pr = window.ytInitialPlayerResponse; if (!pr || !pr.videoDetails) return { error: 'no ytInitialPlayerResponse (page not ready)' }; const vd = pr.videoDetails; const mf = (pr.microformat && pr.microformat.playerMicroformatRenderer) || {}; return { videoId: vd.videoId, title: vd.title || null, channel: vd.author || null, channelId: vd.channelId || null, url: 'https://www.youtube.com/watch?v=' + vd.videoId, views: vd.viewCount || null, lengthSeconds: vd.lengthSeconds ? parseInt(vd.lengthSeconds, 10) : null, publishDate: mf.publishDate || null, category: mf.category || null, keywords: vd.keywords || [], description: vd.shortDescription || null }; } )

Success assertion

{
  "expr": "typeof result === 'object' && (result.videoId || result.error)",
  "type": "value"
}