jdepoix / youtube-transcript-api

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!
MIT License
2.55k stars 280 forks source link

Feature/issue 213 #219

Open crhowell opened 11 months ago

crhowell commented 11 months ago

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