]> jfr.im git - yt-dlp.git/commitdiff
[ie/youtube] Check newly uploaded iOS HLS formats (#8336)
authorbashonly <redacted>
Sat, 28 Oct 2023 08:02:13 +0000 (03:02 -0500)
committerGitHub <redacted>
Sat, 28 Oct 2023 08:02:13 +0000 (08:02 +0000)
Closes #7747
Authored by: bashonly

yt_dlp/YoutubeDL.py
yt_dlp/extractor/youtube.py

index d066efdc7cc1fc71527454fd6eac02e6de9bfbeb..f1016782686e4adf280e990a4521d4cb7d4c5012 100644 (file)
@@ -2338,7 +2338,7 @@ def _check_formats(formats):
                 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
index ded0f915056ea5cdf8b4a663395a4b433559984a..ddbd614d617acc36a628231f5f212e7bd7cae271 100644 (file)
@@ -4560,6 +4560,14 @@ def process_language(container, base_url, lang_code, sub_name, query):
                 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: