From 1bd72e919ba47273194835ba7e477e4b18076e8d Mon Sep 17 00:00:00 2001 From: nosoop Date: Fri, 22 Nov 2024 00:42:23 -0800 Subject: [PATCH] [ie/youtube] Expose 'livestream' media type --- yt_dlp/extractor/youtube.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index a02a2428ab..cc7fcb486d 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2562,16 +2562,17 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'timestamp': 1657627949, 'release_date': '20220712', 'channel_url': 'https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow', - 'description': 'md5:13a6f76df898f5674f9127139f3df6f7', + 'description': 'md5:452d5c82f72bb7e62a4e0297c3f01c23', 'age_limit': 0, 'thumbnail': 'https://i.ytimg.com/vi/jfKfPfyJRdk/maxresdefault.jpg', 'release_timestamp': 1657641570, 'uploader_url': 'https://www.youtube.com/@LofiGirl', 'channel_follower_count': int, 'channel_is_verified': True, - 'title': r're:^lofi hip hop radio ๐Ÿ“š - beats to relax/study to', + 'title': r're:^lofi hip hop radio ๐Ÿ“š beats to relax/study to', 'view_count': int, 'live_status': 'is_live', + 'media_type': 'livestream', 'tags': 'count:32', 'channel': 'Lofi Girl', 'availability': 'public', @@ -2732,6 +2733,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'skip': 'Age-restricted; requires authentication', }, { + 'note': 'Support /live/ URL + media type for post-live content', 'url': 'https://www.youtube.com/live/qVv6vCqciTM', 'info_dict': { 'id': 'qVv6vCqciTM', @@ -2754,6 +2756,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'channel_id': 'UCIdEIHpS0TdkqRkHL5OkLtA', 'categories': ['Entertainment'], 'live_status': 'was_live', + 'media_type': 'livestream', 'release_timestamp': 1671793345, 'channel': 'ใ•ใชใกใ‚ƒใ‚“ใญใ‚‹', 'description': 'md5:6aebf95cc4a1d731aebc01ad6cc9806d', @@ -4568,6 +4571,7 @@ def is_bad_format(fmt): 'tags': keywords, 'playable_in_embed': get_first(playability_statuses, 'playableInEmbed'), 'live_status': live_status, + 'media_type': 'livestream' if get_first(video_details, 'isLiveContent') else None, 'release_timestamp': live_start_time, '_format_sort_fields': ( # source_preference is lower for potentially damaged formats 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'),