[ie/youtube] Expose 'livestream' media type

pull/11605/head
nosoop 1 week ago
parent f919729538
commit 1bd72e919b

@ -2562,16 +2562,17 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'timestamp': 1657627949, 'timestamp': 1657627949,
'release_date': '20220712', 'release_date': '20220712',
'channel_url': 'https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow', 'channel_url': 'https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow',
'description': 'md5:13a6f76df898f5674f9127139f3df6f7', 'description': 'md5:452d5c82f72bb7e62a4e0297c3f01c23',
'age_limit': 0, 'age_limit': 0,
'thumbnail': 'https://i.ytimg.com/vi/jfKfPfyJRdk/maxresdefault.jpg', 'thumbnail': 'https://i.ytimg.com/vi/jfKfPfyJRdk/maxresdefault.jpg',
'release_timestamp': 1657641570, 'release_timestamp': 1657641570,
'uploader_url': 'https://www.youtube.com/@LofiGirl', 'uploader_url': 'https://www.youtube.com/@LofiGirl',
'channel_follower_count': int, 'channel_follower_count': int,
'channel_is_verified': True, '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, 'view_count': int,
'live_status': 'is_live', 'live_status': 'is_live',
'media_type': 'livestream',
'tags': 'count:32', 'tags': 'count:32',
'channel': 'Lofi Girl', 'channel': 'Lofi Girl',
'availability': 'public', 'availability': 'public',
@ -2732,6 +2733,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'skip': 'Age-restricted; requires authentication', 'skip': 'Age-restricted; requires authentication',
}, },
{ {
'note': 'Support /live/ URL + media type for post-live content',
'url': 'https://www.youtube.com/live/qVv6vCqciTM', 'url': 'https://www.youtube.com/live/qVv6vCqciTM',
'info_dict': { 'info_dict': {
'id': 'qVv6vCqciTM', 'id': 'qVv6vCqciTM',
@ -2754,6 +2756,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'channel_id': 'UCIdEIHpS0TdkqRkHL5OkLtA', 'channel_id': 'UCIdEIHpS0TdkqRkHL5OkLtA',
'categories': ['Entertainment'], 'categories': ['Entertainment'],
'live_status': 'was_live', 'live_status': 'was_live',
'media_type': 'livestream',
'release_timestamp': 1671793345, 'release_timestamp': 1671793345,
'channel': 'さなちゃんねる', 'channel': 'さなちゃんねる',
'description': 'md5:6aebf95cc4a1d731aebc01ad6cc9806d', 'description': 'md5:6aebf95cc4a1d731aebc01ad6cc9806d',
@ -4568,6 +4571,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'tags': keywords, 'tags': keywords,
'playable_in_embed': get_first(playability_statuses, 'playableInEmbed'), 'playable_in_embed': get_first(playability_statuses, 'playableInEmbed'),
'live_status': live_status, 'live_status': live_status,
'media_type': 'livestream' if get_first(video_details, 'isLiveContent') else None,
'release_timestamp': live_start_time, 'release_timestamp': live_start_time,
'_format_sort_fields': ( # source_preference is lower for potentially damaged formats '_format_sort_fields': ( # source_preference is lower for potentially damaged formats
'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'), 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'),

Loading…
Cancel
Save