[RTV SLO 4D] Reordered info extraction

This commit is contained in:
Miha Frangež 2021-02-15 16:38:15 +01:00
parent 8fb3a99c34
commit 944f674c6d

View File

@ -57,23 +57,13 @@ class RTVSLO4DIE(InfoExtractor):
'https://api.rtvslo.si/ava/getRecording/' + media_id, media_id, 'https://api.rtvslo.si/ava/getRecording/' + media_id, media_id,
query={'client_id': '19cc0556a5ee31d0d52a0e30b0696b26'})['response'] query={'client_id': '19cc0556a5ee31d0d52a0e30b0696b26'})['response']
extracted = {
'id': media_id,
'title': media_info['title'],
'description': try_get(media_info, 'description'),
'thumbnail': media_info.get('thumbnail_sec'),
'timestamp': unified_timestamp(media_info.get('broadcastDate')),
'duration': media_info.get('duration'),
}
if media_info['mediaType'] == 'video': if media_info['mediaType'] == 'video':
extracted['formats'] = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
media_info['addaptiveMedia']['hls_sec'], media_id, 'mp4', media_info['addaptiveMedia']['hls_sec'], media_id, 'mp4',
entry_protocol='m3u8_native', m3u8_id='hls') entry_protocol='m3u8_native', m3u8_id='hls')
self._sort_formats(extracted['formats'])
elif media_info['mediaType'] == 'audio': elif media_info['mediaType'] == 'audio':
extracted['formats'] = [{ formats = [{
'format_id': file['mediaType'], 'format_id': file['mediaType'],
'url': file['streamers']['http'] + '/' + file['filename'], 'url': file['streamers']['http'] + '/' + file['filename'],
'ext': determine_ext(file['filename']), 'ext': determine_ext(file['filename']),
@ -82,6 +72,14 @@ class RTVSLO4DIE(InfoExtractor):
'vcodec': 'none' 'vcodec': 'none'
} for file in media_info['mediaFiles']] } for file in media_info['mediaFiles']]
self._sort_formats(extracted['formats']) self._sort_formats(formats)
return extracted return {
'id': media_id,
'title': media_info['title'],
'formats': formats,
'description': try_get(media_info, 'description'),
'thumbnail': media_info.get('thumbnail_sec'),
'timestamp': unified_timestamp(media_info.get('broadcastDate')),
'duration': media_info.get('duration'),
}