1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-27 18:11:19 +00:00

Communicate needed wait time through an exception.

Instead of waiting before throwing `ReExtractInfo`, `_wait_until` will now
immediately throw a new exception `ReExtractInfoLater`.
The `_handle_extraction_exceptions` decorator will then either bail out if
the maximum retry count is exceeded, or wait until the specified waiting
period expires.
This commit is contained in:
Paul Storkman
2024-12-27 18:33:59 +01:00
parent ad808c570b
commit de4e709220
2 changed files with 51 additions and 36 deletions

View File

@@ -1110,6 +1110,15 @@ class ReExtractInfo(YoutubeDLError):
self.expected = expected
class ReExtractInfoLater(ReExtractInfo):
""" Video info needs to be re-extracted after a waiting period. """
msg = 'Video is not available yet'
def __init__(self, time):
super().__init__(self.msg, expected=True)
self.time = time
class ThrottledDownload(ReExtractInfo):
""" Download speed below --throttled-rate. """
msg = 'The download speed is below throttle limit'