mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-01 02:37:29 +01:00
[extractor] Standardize _live_title
This commit is contained in:
parent
46383212b3
commit
39ca3b5c7f
@ -2673,6 +2673,9 @@ def process_info(self, info_dict):
|
|||||||
if self._num_downloads >= int(max_downloads):
|
if self._num_downloads >= int(max_downloads):
|
||||||
raise MaxDownloadsReached()
|
raise MaxDownloadsReached()
|
||||||
|
|
||||||
|
if info_dict.get('is_live'):
|
||||||
|
info_dict['title'] += ' ' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
|
||||||
|
|
||||||
# TODO: backward compatibility, to be removed
|
# TODO: backward compatibility, to be removed
|
||||||
info_dict['fulltitle'] = info_dict['title']
|
info_dict['fulltitle'] = info_dict['title']
|
||||||
|
|
||||||
|
@ -233,8 +233,6 @@ def tokenize_url(url, token):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
is_live = video_params.get('livestream') == '1'
|
is_live = video_params.get('livestream') == '1'
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -31,7 +31,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': uuid,
|
'id': uuid,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'thumbnail': try_get(video, lambda x: x['promo_image']['url']),
|
'thumbnail': try_get(video, lambda x: x['promo_image']['url']),
|
||||||
'description': try_get(video, lambda x: x['subheadlines']['basic']),
|
'description': try_get(video, lambda x: x['subheadlines']['basic']),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -280,7 +280,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if info.get('is_live') else title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
})
|
})
|
||||||
|
@ -41,7 +41,7 @@ def _parse_video_data(self, video_data, video_id, is_live):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': video_data.get('description_en') or video_data.get('description_ar'),
|
'description': video_data.get('description_en') or video_data.get('description_ar'),
|
||||||
'thumbnail': 'http://admin.mangomolo.com/analytics/%s' % img if img else None,
|
'thumbnail': 'http://admin.mangomolo.com/analytics/%s' % img if img else None,
|
||||||
'duration': int_or_none(video_data.get('duration')),
|
'duration': int_or_none(video_data.get('duration')),
|
||||||
|
@ -51,7 +51,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': username,
|
'id': username,
|
||||||
'title': self._live_title(channel['data']['title']),
|
'title': channel['data']['title'],
|
||||||
'uploader': username,
|
'uploader': username,
|
||||||
'uploader_id': username,
|
'uploader_id': username,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -49,7 +49,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(uploader or uploader_id),
|
'title': uploader or uploader_id,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
|
@ -581,7 +581,7 @@ def build_format_id(kind):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': clean_html(json_data.get('description')),
|
'description': clean_html(json_data.get('description')),
|
||||||
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
|
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
|
||||||
'thumbnials': thumbnails,
|
'thumbnials': thumbnails,
|
||||||
|
@ -25,7 +25,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(channel_id),
|
'title': channel_id,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -91,7 +91,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': user_id,
|
'id': user_id,
|
||||||
'title': self._live_title(user_id),
|
'title': user_id,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
|
@ -212,8 +212,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
if playlist_len == 1:
|
if playlist_len == 1:
|
||||||
final_title = playlist_title or title
|
final_title = playlist_title or title
|
||||||
if is_live:
|
|
||||||
final_title = self._live_title(final_title)
|
|
||||||
else:
|
else:
|
||||||
final_title = '%s (%s)' % (playlist_title, title)
|
final_title = '%s (%s)' % (playlist_title, title)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(video_id),
|
'title': video_id,
|
||||||
'thumbnail': 'https://roomimg.stream.highwebmedia.com/ri/%s.jpg' % video_id,
|
'thumbnail': 'https://roomimg.stream.highwebmedia.com/ri/%s.jpg' % video_id,
|
||||||
'age_limit': self._rta_search(webpage),
|
'age_limit': self._rta_search(webpage),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
|
@ -3456,10 +3456,8 @@ def _parse_jwplayer_formats(self, jwplayer_sources_data, video_id=None,
|
|||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _live_title(self, name):
|
def _live_title(self, name):
|
||||||
""" Generate the title for a live video """
|
self._downloader.deprecation_warning('yt_dlp.InfoExtractor._live_title is deprecated and does not work as expected')
|
||||||
now = datetime.datetime.now()
|
return name
|
||||||
now_str = now.strftime('%Y-%m-%d %H:%M')
|
|
||||||
return name + ' ' + now_str
|
|
||||||
|
|
||||||
def _int(self, v, name, fatal=False, **kwargs):
|
def _int(self, v, name, fatal=False, **kwargs):
|
||||||
res = int_or_none(v, **kwargs)
|
res = int_or_none(v, **kwargs)
|
||||||
|
@ -305,7 +305,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': clean_html(media.get('description')),
|
'description': clean_html(media.get('description')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'duration': int_or_none(metadata.get('duration')) or None,
|
'duration': int_or_none(metadata.get('duration')) or None,
|
||||||
|
@ -84,7 +84,7 @@ def _real_extract(self, url):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return {
|
return {
|
||||||
'id': display_name,
|
'id': display_name,
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'uploader': display_name,
|
'uploader': display_name,
|
||||||
'uploader_id': username,
|
'uploader_id': username,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -105,7 +105,7 @@ def _real_extract(self, url):
|
|||||||
'aid': 'pcclient'
|
'aid': 'pcclient'
|
||||||
})['data']['live_url']
|
})['data']['live_url']
|
||||||
|
|
||||||
title = self._live_title(unescapeHTML(room['room_name']))
|
title = unescapeHTML(room['room_name'])
|
||||||
description = room.get('show_details')
|
description = room.get('show_details')
|
||||||
thumbnail = room.get('room_src')
|
thumbnail = room.get('room_src')
|
||||||
uploader = room.get('nickname')
|
uploader = room.get('nickname')
|
||||||
|
@ -321,7 +321,7 @@ def _real_extract(self, url):
|
|||||||
channel_data = self._download_json(
|
channel_data = self._download_json(
|
||||||
'https://www.dr.dk/mu-online/api/1.0/channel/' + channel_id,
|
'https://www.dr.dk/mu-online/api/1.0/channel/' + channel_id,
|
||||||
channel_id)
|
channel_id)
|
||||||
title = self._live_title(channel_data['Title'])
|
title = channel_data['Title']
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for streaming_server in channel_data.get('StreamingServers', []):
|
for streaming_server in channel_data.get('StreamingServers', []):
|
||||||
|
@ -170,7 +170,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'display_id': channel_data.get('alias'),
|
'display_id': channel_data.get('alias'),
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': channel_data.get('description'),
|
'description': channel_data.get('description'),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -203,7 +203,7 @@ def _extract_video(self, video_id, catalogue=None):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'thumbnail': image,
|
'thumbnail': image,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
|
@ -59,9 +59,6 @@ def _real_extract(self, url):
|
|||||||
stream_url, video_id, 'mp4',
|
stream_url, video_id, 'mp4',
|
||||||
'm3u8_native', m3u8_id='hls')
|
'm3u8_native', m3u8_id='hls')
|
||||||
|
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -209,6 +209,6 @@ def _real_extract(self, url):
|
|||||||
'https://www.smashcast.tv/api/media/live', video_id)
|
'https://www.smashcast.tv/api/media/live', video_id)
|
||||||
metadata['formats'] = formats
|
metadata['formats'] = formats
|
||||||
metadata['is_live'] = True
|
metadata['is_live'] = True
|
||||||
metadata['title'] = self._live_title(metadata.get('title'))
|
metadata['title'] = metadata.get('title')
|
||||||
|
|
||||||
return metadata
|
return metadata
|
||||||
|
@ -88,7 +88,7 @@ def _real_extract(self, url):
|
|||||||
video_data = self._download_json(dve_api_url, media_id)
|
video_data = self._download_json(dve_api_url, media_id)
|
||||||
is_live = media_type == 'live'
|
is_live = media_type == 'live'
|
||||||
if is_live:
|
if is_live:
|
||||||
title = self._live_title(self._call_api('event/', media_id)['title'])
|
title = self._call_api('event/', media_id)['title']
|
||||||
else:
|
else:
|
||||||
title = video_data['name']
|
title = video_data['name']
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': server_id,
|
'id': server_id,
|
||||||
'title': self._live_title(camera_name or server_id),
|
'title': camera_name or server_id,
|
||||||
'description': description,
|
'description': description,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -112,7 +112,7 @@ def get_flashvar(x, *args, **kwargs):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'upload_date': unified_strdate(_v('time_date')),
|
'upload_date': unified_strdate(_v('time_date')),
|
||||||
'uploader': _v('meta_organisation'),
|
'uploader': _v('meta_organisation'),
|
||||||
'categories': categories,
|
'categories': categories,
|
||||||
@ -161,7 +161,7 @@ def _extract_video(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': video_data.get('description'),
|
'description': video_data.get('description'),
|
||||||
'thumbnail': video_data.get('image'),
|
'thumbnail': video_data.get('image'),
|
||||||
'categories': categories,
|
'categories': categories,
|
||||||
|
@ -116,7 +116,7 @@ def _parse_broadcast_item(self, item):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': broadcast_id,
|
'id': broadcast_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'timestamp': int_or_none(item.get('createdAt')),
|
'timestamp': int_or_none(item.get('createdAt')),
|
||||||
'channel': channel.get('name'),
|
'channel': channel.get('name'),
|
||||||
|
@ -176,7 +176,7 @@ def _extract_stream_info(self, stream_info):
|
|||||||
return {
|
return {
|
||||||
'id': broadcast_id,
|
'id': broadcast_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'title': self._live_title(stream_info['stream_title']) if is_live else stream_info['stream_title'],
|
'title': stream_info['stream_title'],
|
||||||
'thumbnail': stream_info.get('thumbnail_url'),
|
'thumbnail': stream_info.get('thumbnail_url'),
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ def _real_extract(self, url):
|
|||||||
is_live = video_data.get('isLive')
|
is_live = video_data.get('isLive')
|
||||||
info.update({
|
info.update({
|
||||||
'id': content_id,
|
'id': content_id,
|
||||||
'title': self._live_title(info['title']) if is_live else info['title'],
|
'title': info['title'],
|
||||||
'formats': self._extract_video_formats(video_data, content_id),
|
'formats': self._extract_video_formats(video_data, content_id),
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
})
|
})
|
||||||
|
@ -33,7 +33,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': page_id,
|
'id': page_id,
|
||||||
'title': self._live_title(page_id) if self._IS_LIVE else page_id,
|
'title': page_id,
|
||||||
'uploader_id': hidden_inputs.get('userid'),
|
'uploader_id': hidden_inputs.get('userid'),
|
||||||
'duration': int_or_none(hidden_inputs.get('duration')),
|
'duration': int_or_none(hidden_inputs.get('duration')),
|
||||||
'is_live': self._IS_LIVE,
|
'is_live': self._IS_LIVE,
|
||||||
|
@ -49,7 +49,7 @@ def _real_extract(self, url):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title('Матч ТВ - Прямой эфир'),
|
'title': 'Матч ТВ - Прямой эфир',
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ def _real_extract(self, url):
|
|||||||
display_id = 'live'
|
display_id = 'live'
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
title = self._live_title(self._og_search_title(webpage))
|
title = self._og_search_title(webpage)
|
||||||
|
|
||||||
data_js = self._search_regex(
|
data_js = self._search_regex(
|
||||||
r'(?s)\nplaylist:\s*(\[.*?}\]),',
|
r'(?s)\nplaylist:\s*(\[.*?}\]),',
|
||||||
|
@ -305,7 +305,7 @@ def _real_extract(self, url):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': live_source.get('description'),
|
'description': live_source.get('description'),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
@ -545,8 +545,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
title = event_config['eventTitle']
|
title = event_config['eventTitle']
|
||||||
is_live = {'live': True, 'replay': False}.get(event_config.get('eventStatus'))
|
is_live = {'live': True, 'replay': False}.get(event_config.get('eventStatus'))
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
source_url = self._download_json(
|
source_url = self._download_json(
|
||||||
f'https://api-leap.nbcsports.com/feeds/assets/{pid}?application=NBCOlympics&platform=desktop&format=nbc-player&env=staging',
|
f'https://api-leap.nbcsports.com/feeds/assets/{pid}?application=NBCOlympics&platform=desktop&format=nbc-player&env=staging',
|
||||||
|
@ -245,8 +245,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
live = playlist.get('config', {}).get('streamType') in ['httpVideoLive', 'httpAudioLive']
|
live = playlist.get('config', {}).get('streamType') in ['httpVideoLive', 'httpAudioLive']
|
||||||
title = config['title']
|
title = config['title']
|
||||||
if live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
uploader = ppjson.get('config', {}).get('branding')
|
uploader = ppjson.get('config', {}).get('branding')
|
||||||
upload_date = ppjson.get('config', {}).get('publicationDate')
|
upload_date = ppjson.get('config', {}).get('publicationDate')
|
||||||
duration = int_or_none(config.get('duration'))
|
duration = int_or_none(config.get('duration'))
|
||||||
|
@ -89,7 +89,7 @@ def _parse_video_config(self, video_config, display_id):
|
|||||||
'ext': determine_ext(image_url, 'jpg'),
|
'ext': determine_ext(image_url, 'jpg'),
|
||||||
}]
|
}]
|
||||||
info.update({
|
info.update({
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
'description': clean_html(item.get('description')),
|
'description': clean_html(item.get('description')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
|
@ -467,7 +467,7 @@ def add_format_url(format_url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': metadata.get('info'),
|
'description': metadata.get('info'),
|
||||||
'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
|
'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
|
||||||
'upload_date': unified_strdate(metadata.get('gidsdatum')),
|
'upload_date': unified_strdate(metadata.get('gidsdatum')),
|
||||||
@ -561,7 +561,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': stream['url'],
|
'url': stream['url'],
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'acodec': codec,
|
'acodec': codec,
|
||||||
'ext': codec,
|
'ext': codec,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
|
@ -235,7 +235,7 @@ def _extract_desktop(self, url):
|
|||||||
|
|
||||||
assert title
|
assert title
|
||||||
if provider == 'LIVE_TV_APP':
|
if provider == 'LIVE_TV_APP':
|
||||||
info['title'] = self._live_title(title)
|
info['title'] = title
|
||||||
|
|
||||||
quality = qualities(('4', '0', '1', '2', '3', '5'))
|
quality = qualities(('4', '0', '1', '2', '3', '5'))
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ def _real_extract(self, url):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
title = self._live_title(self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title'))
|
r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title')
|
||||||
|
|
||||||
clip = self._search_regex(
|
clip = self._search_regex(
|
||||||
r"clip:\s*\{\s*url:\s*'([^']+)'", webpage, 'clip')
|
r"clip:\s*\{\s*url:\s*'([^']+)'", webpage, 'clip')
|
||||||
|
@ -77,7 +77,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(title.strip()),
|
'title': title.strip(),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'channel': channel_id,
|
'channel': channel_id,
|
||||||
'channel_id': metadata.get('id'),
|
'channel_id': metadata.get('id'),
|
||||||
|
@ -167,8 +167,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
title = item['title']
|
title = item['title']
|
||||||
is_live = item['type'] == 'stream'
|
is_live = item['type'] == 'stream'
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
description = self._og_search_description(webpage, default=None) or self._html_search_meta(
|
description = self._og_search_description(webpage, default=None) or self._html_search_meta(
|
||||||
'description', webpage, 'description', default=None)
|
'description', webpage, 'description', default=None)
|
||||||
timestamp = None
|
timestamp = None
|
||||||
|
@ -29,7 +29,7 @@ def _real_extract(self, url):
|
|||||||
webpage, 'broadcast')
|
webpage, 'broadcast')
|
||||||
|
|
||||||
broadcast = self._parse_json(jscode, radio_id)
|
broadcast = self._parse_json(jscode, radio_id)
|
||||||
title = self._live_title(broadcast['name'])
|
title = broadcast['name']
|
||||||
description = broadcast.get('description') or broadcast.get('shortDescription')
|
description = broadcast.get('description') or broadcast.get('shortDescription')
|
||||||
thumbnail = broadcast.get('picture4Url') or broadcast.get('picture4TransUrl') or broadcast.get('logo100x100')
|
thumbnail = broadcast.get('picture4Url') or broadcast.get('picture4TransUrl') or broadcast.get('logo100x100')
|
||||||
|
|
||||||
|
@ -318,8 +318,7 @@ def _real_extract(self, url):
|
|||||||
info = {
|
info = {
|
||||||
'id': remove_start(media.get('id'), 'ContentItem-') or video_id,
|
'id': remove_start(media.get('id'), 'ContentItem-') or video_id,
|
||||||
'display_id': video_id,
|
'display_id': video_id,
|
||||||
'title': self._live_title(title) if relinker_info.get(
|
'title': title,
|
||||||
'is_live') else title,
|
|
||||||
'alt_title': strip_or_none(alt_title),
|
'alt_title': strip_or_none(alt_title),
|
||||||
'description': media.get('description'),
|
'description': media.get('description'),
|
||||||
'uploader': strip_or_none(media.get('channel')),
|
'uploader': strip_or_none(media.get('channel')),
|
||||||
|
@ -85,8 +85,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
title = data['title']
|
title = data['title']
|
||||||
is_live = data.get('isLive')
|
is_live = data.get('isLive')
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
height_re = r'-(\d+)p\.'
|
height_re = r'-(\d+)p\.'
|
||||||
formats = []
|
formats = []
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': info.get('image'),
|
'thumbnail': info.get('image'),
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
@ -230,7 +230,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'formats': self._extract_png_formats(vidplayer_id),
|
'formats': self._extract_png_formats(vidplayer_id),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'view_count': view_count,
|
'view_count': view_count,
|
||||||
|
@ -73,7 +73,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': compat_str(room.get('live_id') or broadcaster_id),
|
'id': compat_str(room.get('live_id') or broadcaster_id),
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'description': room.get('description'),
|
'description': room.get('description'),
|
||||||
'timestamp': int_or_none(room.get('current_live_started_at')),
|
'timestamp': int_or_none(room.get('current_live_started_at')),
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
|
@ -55,7 +55,7 @@ def _parse_video(self, video, video_id):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': dict_get(video, ('video_still', 'video_still_medium', 'thumb')),
|
'thumbnail': dict_get(video, ('video_still', 'video_still_medium', 'thumb')),
|
||||||
'description': video.get('short_desc') or None,
|
'description': video.get('short_desc') or None,
|
||||||
|
@ -36,7 +36,7 @@ def _real_extract(self, url):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': stream_url,
|
'url': stream_url,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(video_id),
|
'title': video_id,
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -203,10 +203,6 @@ class SVTPlayIE(SVTPlayBaseIE):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _adjust_title(self, info):
|
|
||||||
if info['is_live']:
|
|
||||||
info['title'] = self._live_title(info['title'])
|
|
||||||
|
|
||||||
def _extract_by_video_id(self, video_id, webpage=None):
|
def _extract_by_video_id(self, video_id, webpage=None):
|
||||||
data = self._download_json(
|
data = self._download_json(
|
||||||
'https://api.svt.se/videoplayer-api/video/%s' % video_id,
|
'https://api.svt.se/videoplayer-api/video/%s' % video_id,
|
||||||
@ -220,7 +216,6 @@ def _extract_by_video_id(self, video_id, webpage=None):
|
|||||||
if not title:
|
if not title:
|
||||||
title = video_id
|
title = video_id
|
||||||
info_dict['title'] = title
|
info_dict['title'] = title
|
||||||
self._adjust_title(info_dict)
|
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -251,7 +246,6 @@ def _real_extract(self, url):
|
|||||||
'title': data['context']['dispatcher']['stores']['MetaStore']['title'],
|
'title': data['context']['dispatcher']['stores']['MetaStore']['title'],
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
})
|
})
|
||||||
self._adjust_title(info_dict)
|
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
svt_id = try_get(
|
svt_id = try_get(
|
||||||
|
@ -69,7 +69,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': article_id or display_id,
|
'id': article_id or display_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
|
@ -148,7 +148,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if live else title,
|
'title': title,
|
||||||
'thumbnail': config.get('poster') or None,
|
'thumbnail': config.get('poster') or None,
|
||||||
'description': config.get('description') or None,
|
'description': config.get('description') or None,
|
||||||
'timestamp': parse_iso8601(config.get('upload_date')),
|
'timestamp': parse_iso8601(config.get('upload_date')),
|
||||||
|
@ -62,7 +62,7 @@ def _real_extract(self, url):
|
|||||||
raise ExtractorError('%s is offline' % username, expected=True)
|
raise ExtractorError('%s is offline' % username, expected=True)
|
||||||
program_info = live_info['programInfo']
|
program_info = live_info['programInfo']
|
||||||
program_id = program_info['id']
|
program_id = program_info['id']
|
||||||
title = self._live_title(program_info['title'])
|
title = program_info['title']
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for stream_info in (program_info.get('streamInfo') or []):
|
for stream_info in (program_info.get('streamInfo') or []):
|
||||||
|
@ -62,7 +62,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': content_id,
|
'id': content_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'location': location,
|
'location': location,
|
||||||
|
@ -205,7 +205,7 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
|
@ -106,7 +106,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': strip_or_none(asset.get('description')),
|
'description': strip_or_none(asset.get('description')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'timestamp': parse_iso8601(asset.get('live_broadcast_time') or asset.get('update_time')),
|
'timestamp': parse_iso8601(asset.get('live_broadcast_time') or asset.get('update_time')),
|
||||||
@ -271,7 +271,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': strip_or_none(asset.get('description')),
|
'description': strip_or_none(asset.get('description')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'timestamp': parse_iso8601(asset.get('createTime')),
|
'timestamp': parse_iso8601(asset.get('createTime')),
|
||||||
|
@ -130,9 +130,6 @@ def _real_extract(self, url):
|
|||||||
r'data-image=(["\'])(?P<url>(?:https?:)?//.+?)\1', webpage,
|
r'data-image=(["\'])(?P<url>(?:https?:)?//.+?)\1', webpage,
|
||||||
'thumbnail', default=None, group='url'))
|
'thumbnail', default=None, group='url'))
|
||||||
|
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
view_count = int_or_none(self._search_regex(
|
view_count = int_or_none(self._search_regex(
|
||||||
r'(?s)<div[^>]+\bclass=["\'].*?view-count[^>]+>.*?(\d+).*?</div>',
|
r'(?s)<div[^>]+\bclass=["\'].*?view-count[^>]+>.*?(\d+).*?</div>',
|
||||||
webpage, 'view count', default=None))
|
webpage, 'view count', default=None))
|
||||||
|
@ -80,7 +80,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': resource_id,
|
'id': resource_id,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
}
|
}
|
||||||
|
@ -903,7 +903,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': stream_id,
|
'id': stream_id,
|
||||||
'display_id': channel_name,
|
'display_id': channel_name,
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
|
@ -242,7 +242,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(data['title']) if is_live else data['title'],
|
'title': data['title'],
|
||||||
'description': data['description'],
|
'description': data['description'],
|
||||||
'thumbnail': data['images']['main'] + '?t[]=900x506q80',
|
'thumbnail': data['images']['main'] + '?t[]=900x506q80',
|
||||||
'timestamp': data['published'],
|
'timestamp': data['published'],
|
||||||
|
@ -224,7 +224,7 @@ def _parse_config(self, config, video_id):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': str_or_none(video_data.get('id')) or video_id,
|
'id': str_or_none(video_data.get('id')) or video_id,
|
||||||
'title': self._live_title(video_title) if is_live else video_title,
|
'title': video_title,
|
||||||
'uploader': owner.get('name'),
|
'uploader': owner.get('name'),
|
||||||
'uploader_id': video_uploader_url.split('/')[-1] if video_uploader_url else None,
|
'uploader_id': video_uploader_url.split('/')[-1] if video_uploader_url else None,
|
||||||
'uploader_url': video_uploader_url,
|
'uploader_url': video_uploader_url,
|
||||||
|
@ -434,8 +434,6 @@ def _real_extract(self, url):
|
|||||||
# 2 = live
|
# 2 = live
|
||||||
# 3 = post live (finished live)
|
# 3 = post live (finished live)
|
||||||
is_live = data.get('live') == 2
|
is_live = data.get('live') == 2
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
timestamp = unified_timestamp(self._html_search_regex(
|
timestamp = unified_timestamp(self._html_search_regex(
|
||||||
r'class=["\']mv_info_date[^>]+>([^<]+)(?:<|from)', info_page,
|
r'class=["\']mv_info_date[^>]+>([^<]+)(?:<|from)', info_page,
|
||||||
|
@ -210,7 +210,7 @@ def get_common_fields():
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
info = get_common_fields()
|
info = get_common_fields()
|
||||||
info.update({
|
info.update({
|
||||||
'title': self._live_title(video['title']),
|
'title': video['title'],
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
|
@ -44,11 +44,11 @@ def _real_extract(self, url):
|
|||||||
info = self._download_json(
|
info = self._download_json(
|
||||||
'http://vybory.mos.ru/json/voting_stations/%s/%s.json'
|
'http://vybory.mos.ru/json/voting_stations/%s/%s.json'
|
||||||
% (compat_str(station_id)[:3], station_id),
|
% (compat_str(station_id)[:3], station_id),
|
||||||
station_id, 'Downloading station JSON', fatal=False)
|
station_id, 'Downloading station JSON', fatal=False) or {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': station_id,
|
'id': station_id,
|
||||||
'title': self._live_title(info['name'] if info else station_id),
|
'title': info.get('name') or station_id,
|
||||||
'description': info.get('address'),
|
'description': info.get('address'),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
@ -117,7 +117,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': tracker_data.get('trackerClipId', video_id),
|
'id': tracker_data.get('trackerClipId', video_id),
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'alt_title': tracker_data.get('trackerClipSubcategory'),
|
'alt_title': tracker_data.get('trackerClipSubcategory'),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
|
@ -264,7 +264,7 @@ def _extract_yahoo_video(self, video_id, country):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'description': clean_html(video.get('description')),
|
'description': clean_html(video.get('description')),
|
||||||
|
@ -58,7 +58,7 @@ def _real_extract(self, url):
|
|||||||
return {
|
return {
|
||||||
'id': uploader,
|
'id': uploader,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'title': self._live_title(uploader),
|
'title': uploader,
|
||||||
'thumbnail': data.get('awsUrl'),
|
'thumbnail': data.get('awsUrl'),
|
||||||
'tags': data.get('tags'),
|
'tags': data.get('tags'),
|
||||||
'categories': data.get('tags'),
|
'categories': data.get('tags'),
|
||||||
|
@ -2810,7 +2810,7 @@ def feed_entry(name):
|
|||||||
|
|
||||||
info = {
|
info = {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(video_title) if is_live else video_title,
|
'title': video_title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
# The best thumbnail that we are sure exists. Prevents unnecessary
|
# The best thumbnail that we are sure exists. Prevents unnecessary
|
||||||
|
@ -187,7 +187,7 @@ def _extract_video(self, channel_name, video_id, record_id=None, is_live=False):
|
|||||||
cid = self._extract_cid(video_id, channel_name)
|
cid = self._extract_cid(video_id, channel_name)
|
||||||
info_dict = {
|
info_dict = {
|
||||||
'id': channel_name,
|
'id': channel_name,
|
||||||
'title': self._live_title(channel_name),
|
'title': channel_name,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user