From ef79d20dc9d27ac002a7196f073b37f2f2721aed Mon Sep 17 00:00:00 2001 From: bashonly <88596187+bashonly@users.noreply.github.com> Date: Sat, 28 Oct 2023 03:02:13 -0500 Subject: [PATCH] [ie/youtube] Check newly uploaded iOS HLS formats (#8336) Closes #7747 Authored by: bashonly --- yt_dlp/YoutubeDL.py | 2 +- yt_dlp/extractor/youtube.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index d066efdc7c..f101678268 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2338,7 +2338,7 @@ class YoutubeDL: return for f in formats: - if f.get('has_drm'): + if f.get('has_drm') or f.get('__needs_testing'): yield from self._check_formats([f]) else: yield f diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index ded0f91505..ddbd614d61 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -4560,6 +4560,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor): self._parse_time_text(self._get_text(vpir, 'dateText'))) or upload_date info['upload_date'] = upload_date + if upload_date and live_status not in ('is_live', 'post_live', 'is_upcoming'): + # Newly uploaded videos' HLS formats are potentially problematic and need to be checked + upload_datetime = datetime_from_str(upload_date).replace(tzinfo=datetime.timezone.utc) + if upload_datetime >= datetime_from_str('today-1day'): + for fmt in info['formats']: + if fmt.get('protocol') == 'm3u8_native': + fmt['__needs_testing'] = True + for s_k, d_k in [('artist', 'creator'), ('track', 'alt_title')]: v = info.get(s_k) if v: