[extractor/RUTV] Fix warnings for livestreams (#5016)

Authored by: Lesmiscore
This commit is contained in:
Lesmiscore 2022-09-24 18:30:58 +09:00 committed by GitHub
parent faf7863bb0
commit 5c8b2ee9ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -141,7 +141,7 @@ class RUTVIE(InfoExtractor):
if media['errors']: if media['errors']:
raise ExtractorError('%s said: %s' % (self.IE_NAME, media['errors']), expected=True) raise ExtractorError('%s said: %s' % (self.IE_NAME, media['errors']), expected=True)
view_count = playlist.get('count_views') view_count = int_or_none(playlist.get('count_views'))
priority_transport = playlist['priority_transport'] priority_transport = playlist['priority_transport']
thumbnail = media['picture'] thumbnail = media['picture']
@ -152,6 +152,7 @@ class RUTVIE(InfoExtractor):
duration = int_or_none(media.get('duration')) duration = int_or_none(media.get('duration'))
formats = [] formats = []
subtitles = {}
for transport, links in media['sources'].items(): for transport, links in media['sources'].items():
for quality, url in links.items(): for quality, url in links.items():
@ -171,8 +172,10 @@ class RUTVIE(InfoExtractor):
'vbr': str_to_int(quality), 'vbr': str_to_int(quality),
} }
elif transport == 'm3u8': elif transport == 'm3u8':
formats.extend(self._extract_m3u8_formats( fmt, subs = self._extract_m3u8_formats_and_subtitles(
url, video_id, 'mp4', quality=preference, m3u8_id='hls')) url, video_id, 'mp4', quality=preference, m3u8_id='hls')
formats.extend(fmt)
self._merge_subtitles(subs, target=subtitles)
continue continue
else: else:
fmt = { fmt = {
@ -186,7 +189,7 @@ class RUTVIE(InfoExtractor):
}) })
formats.append(fmt) formats.append(fmt)
self._sort_formats(formats) self._sort_formats(formats, ('source', ))
return { return {
'id': video_id, 'id': video_id,
@ -196,5 +199,6 @@ class RUTVIE(InfoExtractor):
'view_count': view_count, 'view_count': view_count,
'duration': duration, 'duration': duration,
'formats': formats, 'formats': formats,
'subtitles': subtitles,
'is_live': is_live, 'is_live': is_live,
} }