if media['errors']:
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']
thumbnail = media['picture']
duration = int_or_none(media.get('duration'))
formats = []
+ subtitles = {}
for transport, links in media['sources'].items():
for quality, url in links.items():
'vbr': str_to_int(quality),
}
elif transport == 'm3u8':
- formats.extend(self._extract_m3u8_formats(
- url, video_id, 'mp4', quality=preference, m3u8_id='hls'))
+ fmt, subs = self._extract_m3u8_formats_and_subtitles(
+ url, video_id, 'mp4', quality=preference, m3u8_id='hls')
+ formats.extend(fmt)
+ self._merge_subtitles(subs, target=subtitles)
continue
else:
fmt = {
})
formats.append(fmt)
- self._sort_formats(formats)
+ self._sort_formats(formats, ('source', ))
return {
'id': video_id,
'view_count': view_count,
'duration': duration,
'formats': formats,
+ 'subtitles': subtitles,
'is_live': is_live,
}