When you callDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vsmutok/ytscrape/llms.txt
Use this file to discover all available pages before exploring further.
YouTube.search() it returns a SearchResults object. Iterating over it yields one of three frozen dataclass models — Video, Channel, or Playlist — depending on what YouTube returned for that position in the results. All three models are immutable (frozen=True) and use __slots__ for memory efficiency.
Video
Represents a single video result from a search query.The unique YouTube video identifier (e.g.
"dQw4w9WgXcQ"). Never None.The video title as displayed in search results. May be
None if YouTube did not include it in the response.Display name of the uploading channel (e.g.
"Rick Astley").The internal channel identifier that begins with
UC (e.g. "UCuAXFkgsw1L7xaCfnd5JJOw"). Useful for passing to YouTube.channel().Human-formatted duration string as shown on YouTube (e.g.
"10:23" or "1:02:47"). None for live streams or when unavailable.Formatted view count exactly as YouTube renders it (e.g.
"1.2M views" or "42,318 views"). Use this for display; parse it manually if you need a number.Relative publication date as shown in search results (e.g.
"3 days ago", "2 years ago"). None for live streams.URL of the highest-resolution thumbnail available in the search response.
Property. The canonical watch URL constructed from
video_id: https://www.youtube.com/watch?v={video_id}.Channel
Represents a single channel result from a search query.The internal channel identifier (e.g.
"UCuAXFkgsw1L7xaCfnd5JJOw"). Never None.The channel name (e.g.
"Rick Astley").The channel’s
@handle if present in the search result (e.g. "@RickAstleyYT").Formatted subscriber count as YouTube renders it (e.g.
"1.2M subscribers").Formatted video count as YouTube renders it (e.g.
"142 videos").URL of the channel’s avatar thumbnail as returned in the search result.
Property. The canonical channel URL:
https://www.youtube.com/channel/{channel_id}.Playlist
Represents a single playlist result from a search query.The unique playlist identifier (e.g.
"PLbpi6ZahtOH6Ar_3GPy3workFpaikFpY3"). Never None.The playlist title as shown in search results.
Display name of the channel that owns the playlist.
The number of videos in the playlist as a string (e.g.
"42").URL of the playlist’s cover thumbnail.
Property. The canonical playlist URL:
https://www.youtube.com/playlist?list={playlist_id}.SearchResults
SearchResults is the lazy, paginated container returned by YouTube.search(). It transparently fetches new pages from YouTube as you consume items, so a simple for loop is all you need.
Properties
True when YouTube has at least one more page of results that can be fetched. Becomes False once the continuation token is exhausted.Methods
Explicitly fetches the next page of results, appends them to the internal buffer, and returns the newly added items as a list. Returns an empty list when there are no more pages. Use this when you want fine-grained control over network calls instead of relying on the implicit iterator.
Iteration
SearchResults is directly iterable. Each iteration step yields a Video, Channel, or Playlist instance. New pages are fetched automatically whenever the internal buffer runs out.
Limiting results
Passmax_results to YouTube.search() to cap how many items are yielded. The iterator stops once that number is reached, even if more pages exist.