1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-30 23:22:56 +01:00

[screenwavemedia] Improve formats extraction

This commit is contained in:
Sergey M․ 2016-02-28 20:05:58 +06:00
parent 9173202b84
commit 6c10dbeae9

View File

@ -70,19 +70,19 @@ class ScreenwaveMediaIE(InfoExtractor):
formats = [] formats = []
for source in sources: for source in sources:
if source['type'] == 'hls': file_ = source.get('file')
formats.extend(self._extract_m3u8_formats(source['file'], video_id, ext='mp4')) if not file_:
continue
if source.get('type') == 'hls':
formats.extend(self._extract_m3u8_formats(file_, video_id, ext='mp4'))
else: else:
file_ = source.get('file')
if not file_:
continue
format_label = source.get('label') format_label = source.get('label')
format_id = self._search_regex( format_id = self._search_regex(
r'_(.+?)\.[^.]+$', file_, 'format id', default=None) r'_(.+?)\.[^.]+$', file_, 'format id', default=None)
height = int_or_none(self._search_regex( height = int_or_none(self._search_regex(
r'^(\d+)[pP]', format_label, 'height', default=None)) r'^(\d+)[pP]', format_label, 'height', default=None))
formats.append({ formats.append({
'url': source['file'], 'url': file_,
'format_id': format_id, 'format_id': format_id,
'format': format_label, 'format': format_label,
'ext': source.get('type'), 'ext': source.get('type'),