[teamcoco] Extract m3u8 URLs

This commit is contained in:
Naglis Jonaitis 2015-04-09 23:57:51 +03:00
parent ce9f47de99
commit 5bb6328cb9

View file

@ -62,23 +62,27 @@ class TeamcocoIE(InfoExtractor):
formats = [] formats = []
get_quality = qualities(['500k', '480p', '1000k', '720p', '1080p']) get_quality = qualities(['500k', '480p', '1000k', '720p', '1080p'])
for filed in data['files']: for filed in data['files']:
m_format = re.search(r'(\d+(k|p))\.mp4', filed['url']) if filed['type'] == 'hls':
if m_format is not None: formats.extend(self._extract_m3u8_formats(
format_id = m_format.group(1) filed['url'], video_id, ext='mp4'))
else: else:
format_id = filed['bitrate'] m_format = re.search(r'(\d+(k|p))\.mp4', filed['url'])
tbr = ( if m_format is not None:
int(filed['bitrate']) format_id = m_format.group(1)
if filed['bitrate'].isdigit() else:
else None) format_id = filed['bitrate']
tbr = (
int(filed['bitrate'])
if filed['bitrate'].isdigit()
else None)
formats.append({ formats.append({
'url': filed['url'], 'url': filed['url'],
'ext': 'mp4', 'ext': 'mp4',
'tbr': tbr, 'tbr': tbr,
'format_id': format_id, 'format_id': format_id,
'quality': get_quality(format_id), 'quality': get_quality(format_id),
}) })
self._sort_formats(formats) self._sort_formats(formats)