All errors raised by ytscrape are subclasses of a single base exception,Documentation 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.
YtScraperError. This makes it easy to write a broad catch-all while still being able to distinguish specific failure modes when you need to react differently. The hierarchy splits into four concrete error categories and one abstract transcript sub-hierarchy.
Exception hierarchy
Import path
YtScraperError
The base class for every exception in ytscrape. Catching YtScraperError guarantees you will not miss any library-raised error, regardless of which operation triggered it.
Inherits from: Exception
ContextExtractionError
Inherits from: YtScraperError
Raised when ytscrape cannot extract the InnerTube context from the YouTube page. The InnerTube context (API key, client version, and related fields) is bootstrapped from the initial page HTML; if that HTML is missing the expected data — because of a YouTube layout change, a bot-detection response, or a network error at page-load time — this exception is raised before any API call is attempted.
Extra attributes: none beyond the message string.
RequestError
Inherits from: YtScraperError
Raised when an HTTP request to a YouTube InnerTube endpoint fails. This covers network-level failures such as timeouts, connection errors, and non-2xx responses from the API.
Extra attributes: none beyond the message string.
ParseError
Inherits from: YtScraperError
Raised when a YouTube API response cannot be parsed into the expected structure. This can happen if YouTube changes its response schema, returns an unexpected payload, or when comments are disabled for a video and the expected comment continuation data is absent.
Extra attributes: none beyond the message string.
TranscriptError
Inherits from: YtScraperError
Abstract base class for all transcript and caption-related failures. Catch this type to handle any transcript problem without distinguishing between captions being absent entirely versus the requested language not being available.
Extra attributes: none beyond the message string.
TranscriptsDisabled
Inherits from: TranscriptError
Raised when a video has no caption tracks at all — either because the owner has disabled subtitles or because YouTube returned no caption data for the video.
Constructor
The YouTube video ID for which captions were requested.
Attributes
The ID of the video that has no available caption tracks.
NoTranscriptFound
Inherits from: TranscriptError
Raised when the video has caption tracks but none of them match any of the requested languages. The exception carries the full list of requested languages and the languages that were actually available, making it straightforward to surface a helpful error message or fall back to an available language.
Constructor
The YouTube video ID for which the transcript was requested.
The ordered list of language codes that were requested but not found.
The language codes of caption tracks that are actually available for the video. Defaults to an empty tuple when not provided. Displayed as
"(none listed)" in the exception message if empty.Attributes
The ID of the video whose transcript could not be found.
The language codes that were requested, stored as a tuple.
The language codes of caption tracks that are available for this video, stored as a tuple. Empty if YouTube returned no language list.