A feature-rich command-line audio/video downloader
[ntvde] Fix extraction
Sergey M․163e8369b0d2
diff --git a/youtube_dl/extractor/ntvde.py b/youtube_dl/extractor/ntvde.pyindex d2cfe09619..8268eace75 100644--- a/youtube_dl/extractor/ntvde.py+++ b/youtube_dl/extractor/ntvde.py@@ -2,6 +2,7 @@from __future__ import unicode_literalsfrom .common import InfoExtractor+from ..compat import compat_urlparsefrom ..utils import (int_or_none,js_to_json,@@ -42,18 +43,24 @@ class NTVDeIE(InfoExtractor):webpage, 'player data'),video_id, transform_source=js_to_json)duration = parse_duration(vdata.get('duration'))- formats = [{- 'format_id': 'flash',- 'url': 'rtmp://fms.n-tv.de/' + vdata['video'],- }, {- 'format_id': 'mobile',- 'url': 'http://video.n-tv.de' + vdata['videoMp4'],- 'tbr': 400, # estimation- }]- m3u8_url = '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))++ formats = []+ if vdata.get('video'):+ formats.append({+ 'format_id': 'flash',+ 'url': 'rtmp://fms.n-tv.de/%s' % vdata['video'],+ })+ if vdata.get('videoMp4'):+ formats.append({+ 'format_id': 'mobile',+ 'url': compat_urlparse.urljoin('http://video.n-tv.de', vdata['videoMp4']),+ '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)return {