aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLesmiscore <nao20010128@gmail.com>2022-02-26 12:34:36 +0900
committerLesmiscore <nao20010128@gmail.com>2022-02-26 12:34:36 +0900
commit195c22840c594c8f9229cb47ffec2a8984c53a0c (patch)
tree1578d4a9b0797d77410e394694cf312f5b7ea288
parentf0734e1190630f4cefa4a2028884413f54310f82 (diff)
downloadhypervideo-pre-195c22840c594c8f9229cb47ffec2a8984c53a0c.tar.lz
hypervideo-pre-195c22840c594c8f9229cb47ffec2a8984c53a0c.tar.xz
hypervideo-pre-195c22840c594c8f9229cb47ffec2a8984c53a0c.zip
[downloader/fragment] Ignore `FileNotFoundError` when downloading livestreams
when `--live-from-start` is used for YouTube and the live ends, request for the last segment prematurely ends (or 404, 403). this is causing lack of the file and `FileNotFoundError` lacking segment doesn't have any data, so it's safe to ignore
-rw-r--r--yt_dlp/downloader/fragment.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py
index 7b213cd5f..24f4ec959 100644
--- a/yt_dlp/downloader/fragment.py
+++ b/yt_dlp/downloader/fragment.py
@@ -137,7 +137,12 @@ class FragmentFD(FileDownloader):
if fragment_info_dict.get('filetime'):
ctx['fragment_filetime'] = fragment_info_dict.get('filetime')
ctx['fragment_filename_sanitized'] = fragment_filename
- return True, self._read_fragment(ctx)
+ try:
+ return True, self._read_fragment(ctx)
+ except FileNotFoundError:
+ if not info_dict.get('is_live'):
+ raise
+ return False, None
def _read_fragment(self, ctx):
down, frag_sanitized = self.sanitize_open(ctx['fragment_filename_sanitized'], 'rb')