From b3edc8068e00d558d5fecf79ac36a1c8c7365e3a Mon Sep 17 00:00:00 2001 From: coletdev Date: Mon, 14 Mar 2022 11:03:40 +1300 Subject: [PATCH] [downloader/mhtml] Fix fragments with absolute urls (#3044) Authored-by: coletdjnz --- yt_dlp/downloader/mhtml.py | 6 +++++- yt_dlp/extractor/francetv.py | 2 +- yt_dlp/extractor/youtube.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/yt_dlp/downloader/mhtml.py b/yt_dlp/downloader/mhtml.py index 1477f65a69..bc86fd1bf7 100644 --- a/yt_dlp/downloader/mhtml.py +++ b/yt_dlp/downloader/mhtml.py @@ -166,7 +166,11 @@ def real_download(self, filename, info_dict): if (i + 1) <= ctx['fragment_index']: continue - fragment_url = urljoin(fragment_base_url, fragment['path']) + fragment_url = fragment.get('url') + if not fragment_url: + assert fragment_base_url + fragment_url = urljoin(fragment_base_url, fragment['path']) + success, frag_content = self._download_fragment(ctx, fragment_url, info_dict) if not success: continue diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py index 877c5c0556..347a766d8f 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -187,7 +187,7 @@ def _extract_video(self, video_id, catalogue=None): 'protocol': 'mhtml', 'url': 'about:invalid', 'fragments': [{ - 'path': sheet, + 'url': sheet, # XXX: not entirely accurate; each spritesheet seems to be # a 10×10 grid of thumbnails corresponding to approximately # 2 seconds of the video; the last spritesheet may be shorter diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 7e3f142c72..4fe9cec5b3 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -3208,7 +3208,7 @@ def _extract_storyboard(self, player_responses, duration): 'width': width, 'height': height, 'fragments': [{ - 'path': url.replace('$M', str(j)), + 'url': url.replace('$M', str(j)), 'duration': min(fragment_duration, duration - (j * fragment_duration)), } for j in range(math.ceil(fragment_count))], }