]> jfr.im git - yt-dlp.git/commitdiff
[extractor/youtube] Add `live_status=post_live` (#4495)
authorlazypete365 <redacted>
Sun, 31 Jul 2022 20:12:04 +0000 (22:12 +0200)
committerGitHub <redacted>
Sun, 31 Jul 2022 20:12:04 +0000 (01:42 +0530)
Related: https://github.com/yt-dlp/yt-dlp/issues/1564
Authored by: lazypete365

README.md
yt_dlp/extractor/common.py
yt_dlp/extractor/youtube.py

index 7b416f39a7fea7c7e8ff84719b868d392ae52cf9..7710716533c122b3362c7a7b570eb048fd655e96 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1257,7 +1257,7 @@ # OUTPUT TEMPLATE
  - `average_rating` (numeric): Average rating give by users, the scale used depends on the webpage
  - `comment_count` (numeric): Number of comments on the video (For some extractors, comments are only downloaded at the end, and so this field cannot be used)
  - `age_limit` (numeric): Age restriction for the video (years)
- - `live_status` (string): One of "is_live", "was_live", "is_upcoming", "not_live"
+ - `live_status` (string): One of "not_live", "is_live", "is_upcoming", "was_live", "post_live" (was live, but VOD is not yet processed)
  - `is_live` (boolean): Whether this video is a live stream or a fixed-length video
  - `was_live` (boolean): Whether this video was originally a live stream
  - `playable_in_embed` (string): Whether this video is allowed to play in embedded players on other sites
index fc087a69ce0fdba018f524ccb57f27180c84f6a3..d168763e0bcfa2165ee2ed188e763fa4252253ca 100644 (file)
@@ -312,7 +312,8 @@ class InfoExtractor:
                     live stream that goes on instead of a fixed-length video.
     was_live:       True, False, or None (=unknown). Whether this video was
                     originally a live stream.
-    live_status:    'is_live', 'is_upcoming', 'was_live', 'not_live' or None (=unknown)
+    live_status:    None (=unknown), 'is_live', 'is_upcoming', 'was_live', 'not_live'
+                    or 'post_live' (was live, but VOD is not yet processed)
                     If absent, automatically set from is_live, was_live
     start_time:     Time in seconds where the reproduction should start, as
                     specified in the URL.
index 02305c3f9968ebce984aac6b8ada03fa630a743f..fb23afbad69ac5d09f403fcc8bbe03afaca40abc 100644 (file)
@@ -3463,13 +3463,6 @@ def feed_entry(name):
             or get_first(microformats, 'lengthSeconds')
             or parse_duration(search_meta('duration'))) or None
 
-        if get_first(video_details, 'isPostLiveDvr'):
-            self.write_debug('Video is in Post-Live Manifestless mode')
-            if (duration or 0) > 4 * 3600:
-                self.report_warning(
-                    'The livestream has not finished processing. Only 4 hours of the video can be currently downloaded. '
-                    'This is a known issue and patches are welcome')
-
         live_broadcast_details, is_live, streaming_data, formats, automatic_captions = \
             self._list_formats(video_id, microformats, video_details, player_responses, player_url)
 
@@ -3600,6 +3593,14 @@ def feed_entry(name):
             'release_timestamp': live_start_time,
         }
 
+        if get_first(video_details, 'isPostLiveDvr'):
+            self.write_debug('Video is in Post-Live Manifestless mode')
+            info['live_status'] = 'post_live'
+            if (duration or 0) > 4 * 3600:
+                self.report_warning(
+                    'The livestream has not finished processing. Only 4 hours of the video can be currently downloaded. '
+                    'This is a known issue and patches are welcome')
+
         subtitles = {}
         pctr = traverse_obj(player_responses, (..., 'captions', 'playerCaptionsTracklistRenderer'), expected_type=dict)
         if pctr: