[mnet] fix format extraction(fixes #14883)

This commit is contained in:
Remita Amine 2017-11-30 23:37:05 +01:00
parent 1663b32946
commit f5ac68d88f

View file

@ -40,21 +40,29 @@ class MnetIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
# TODO: extract rtmp formats
# no stype -> rtmp url
# stype=H -> m3u8 url
# stype=M -> mpd url
info = self._download_json( info = self._download_json(
'http://content.api.mnet.com/player/vodConfig?id=%s&ctype=CLIP' % video_id, 'http://content.api.mnet.com/player/vodConfig',
video_id, 'Downloading vod config JSON')['data']['info'] video_id, 'Downloading vod config JSON', query={
'id': video_id,
'ctype': 'CLIP',
'stype': 'H',
})['data']['info']
title = info['title'] title = info['title']
rtmp_info = self._download_json( cdn_data = self._download_json(
info['cdn'], video_id, 'Downloading vod cdn JSON') info['cdn'], video_id, 'Downloading vod cdn JSON')['data'][0]
m3u8_url = cdn_data['url']
formats = [{ token = cdn_data.get('token')
'url': rtmp_info['serverurl'] + rtmp_info['fileurl'], if token and token != '-':
'ext': 'flv', m3u8_url += '?' + token
'page_url': url, formats = self._extract_wowza_formats(
'player_url': 'http://flvfile.mnet.com/service/player/201602/cjem_player_tv.swf?v=201602191318', m3u8_url, video_id, skip_protocols=['rtmp', 'rtsp', 'f4m'])
}] self._sort_formats(formats)
description = info.get('ment') description = info.get('ment')
duration = parse_duration(info.get('time')) duration = parse_duration(info.get('time'))