Skip to content

Add YouTubeResponseIsEmpty exception to handle empty YouTube responses #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

etienneschalk
Copy link

Title
➔ Add YouTubeResponseIsEmpty exception to handle empty YouTube responses

Description
This PR introduces a new YouTubeResponseIsEmpty exception, derived from CouldNotRetrieveTranscript.
It is raised when a request to YouTube succeeds but the response content is empty, making transcript parsing impossible.

Main changes:

  • Added the YouTubeResponseIsEmpty class in _errors.py.
  • Updated _transcripts.py to check if the response content is empty before attempting to parse it.
  • Improved error handling for cases where YouTube returns an empty response without an HTTP error.

This enhancement provides clearer diagnostics for this specific failure scenario and suggests retrying later, as indicated in the exception message.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14679514702

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 99.821%

Files with Coverage Reduction New Missed Lines %
_transcripts.py 1 99.55%
Totals Coverage Status
Change from base Build 14612450470: -0.2%
Covered Lines: 559
Relevant Lines: 560

💛 - Coveralls

@etienneschalk
Copy link
Author

Hi @jdepoix ,

Is there a way to retrigger the coverage build ? I added a unit test and coverage is now back to 100%

Thanks!

@jdepoix
Copy link
Owner

jdepoix commented Jun 12, 2025

Hi @etienneschalk!

Thank you for your contribution! 🙏

However, due to the recent changes in v1.1.0 this is no longer needed and I will close this PR.

@jdepoix jdepoix closed this Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants