This is a python API which allows you to get the transcript/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require an API key nor a headless browser, like other selenium based solutions do!
Updates _extract_captions_json method to do additional html splitting to attempt to extract out the playabilityStatus JSON object so we may match and raise a more specific error against the "status" field.
Updates CouldNotRetrieveTranscript class to accept playabilityStatus JSON object so we can generate more informative errors with cause, reason, subreason attached.
Adds two playability error helper methods: get_playability_subreason, get_playability_error
Adds tests to cover the 2 new error classes: VideoUnplayable and LoginRequired
Updates
_extract_captions_json
method to do additional html splitting to attempt to extract out theplayabilityStatus
JSON object so we may match and raise a more specific error against the "status" field.Updates
CouldNotRetrieveTranscript
class to acceptplayabilityStatus
JSON object so we can generate more informative errors with cause, reason, subreason attached.Adds two playability error helper methods:
get_playability_subreason
,get_playability_error
Adds tests to cover the 2 new error classes:
VideoUnplayable
andLoginRequired