]> jfr.im git - yt-dlp.git/commitdiff
[Youtube] Choose correct Live chat API for upcoming streams (#460)
authorkrichbanana <redacted>
Fri, 2 Jul 2021 00:29:29 +0000 (20:29 -0400)
committerGitHub <redacted>
Fri, 2 Jul 2021 00:29:29 +0000 (05:59 +0530)
Authored by: krichbanana

yt_dlp/extractor/youtube.py

index 8ecc34a89c3a657b9afa90b3bee8f4294b4bbd33..1233cc399b0d4758f6cea5a4aaf359b999f9977c 100644 (file)
@@ -2604,6 +2604,7 @@ def feed_entry(name):
             or microformat.get('lengthSeconds')) \
             or parse_duration(search_meta('duration'))
         is_live = video_details.get('isLive')
+        is_upcoming = video_details.get('isUpcoming')
         owner_profile_url = microformat.get('ownerProfileUrl')
 
         info = {
@@ -2729,7 +2730,7 @@ def process_language(container, base_url, lang_code, sub_name, query):
                 'url': 'https://www.youtube.com/watch?v=%s' % video_id,  # url is needed to set cookies
                 'video_id': video_id,
                 'ext': 'json',
-                'protocol': 'youtube_live_chat' if is_live else 'youtube_live_chat_replay',
+                'protocol': 'youtube_live_chat' if is_live or is_upcoming else 'youtube_live_chat_replay',
             }]
         except (KeyError, IndexError, TypeError):
             pass