[ntvde] Fix extraction

This commit is contained in:
Sergey M․ 2016-01-14 22:05:04 +06:00
parent 5cc9c5dfa8
commit 163e8369b0

View file

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
js_to_json, js_to_json,
@ -42,18 +43,24 @@ class NTVDeIE(InfoExtractor):
webpage, 'player data'), webpage, 'player data'),
video_id, transform_source=js_to_json) video_id, transform_source=js_to_json)
duration = parse_duration(vdata.get('duration')) duration = parse_duration(vdata.get('duration'))
formats = [{
'format_id': 'flash', formats = []
'url': 'rtmp://fms.n-tv.de/' + vdata['video'], if vdata.get('video'):
}, { formats.append({
'format_id': 'mobile', 'format_id': 'flash',
'url': 'http://video.n-tv.de' + vdata['videoMp4'], 'url': 'rtmp://fms.n-tv.de/%s' % vdata['video'],
'tbr': 400, # estimation })
}] if vdata.get('videoMp4'):
m3u8_url = 'http://video.n-tv.de' + vdata['videoM3u8'] formats.append({
formats.extend(self._extract_m3u8_formats( 'format_id': 'mobile',
m3u8_url, video_id, ext='mp4', 'url': compat_urlparse.urljoin('http://video.n-tv.de', vdata['videoMp4']),
entry_protocol='m3u8_native', preference=0)) 'tbr': 400, # estimation
})
if vdata.get('videoM3u8'):
m3u8_url = compat_urlparse.urljoin('http://video.n-tv.de', vdata['videoM3u8'])
formats.extend(self._extract_m3u8_formats(
m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native',
preference=0, m3u8_id='hls', fatal=False))
self._sort_formats(formats) self._sort_formats(formats)
return { return {