List YouTube watch history
List the videos and Shorts in your YouTube watch history, newest first, as the history page shows them: one entry per video with its day heading, id, title, url, channel, view count, duration and how much of it was watched. Returns the first page of the history (about 200 entries) and a nextCursor when older entries exist. Returns an empty list when watch history is paused or cleared for the account.
Input
None
Output
items requirednextCursor requiredOpaque token present when older history exists beyond this page. Informational: this script returns the first page only.
FAQ
Get YouTube video transcript
Fetch a YouTube video's caption transcript (auto-generated or uploaded) with per-segment timestamps. Returns available:false when the video has no captions in any language. PROBABILISTIC — expect roughly 1 run in 3 to fail and retry rather than treating a failure as a defect: the transcript can only be read by letting YouTube's own player request the caption track (the /api/timedtext endpoint is bound to a token the player mints, so the URLs in the page's own data return an empty response), and when YouTube serves a pre-roll ad the ad occupies the player and the caption request never happens. The script already reloads and retries 3x; more attempts do not help, because an ad that holds the player holds it for every attempt in the run. Retry the call later, or on a viewing context that is not served ads. Separately, on the managed browser YouTube increasingly answers with its "Sign in to confirm you're not a bot" gate and no transcript is returned at all; the paired-extension browser is the more reliable target today.
Search YouTube videos
Search YouTube videos by query, or list a channel's or playlist's videos from its URL. Returns a list of videos with id, title, url, duration, channelName, channelUrl, viewCount, date, thumbnailUrl, and description.
Get YouTube comments
List a YouTube video's top-level comments from a watch URL or video id. Per comment: id, text, author, channelId, authorAvatar, publishedTime, likeCount, replyCount, isVerified, isCreator, pinned. Sort by 'top' (default) or 'newest' and paginate with the returned nextCursor. likeCount and replyCount are YouTube's abbreviated strings (e.g. "255k", "960"), and comments come back empty when they are disabled.
