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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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.

2 participants