diff options
author | remitamine <remitamine@gmail.com> | 2015-12-04 16:38:05 +0100 |
---|---|---|
committer | remitamine <remitamine@gmail.com> | 2015-12-04 16:38:05 +0100 |
commit | bee4c5571a18ac52aada80ac7ce9c3e409c18293 (patch) | |
tree | 2535f88ed68d64af228a27249b8a8c42dce4e15e /youtube_dl | |
parent | 96929dd1e835842cd3c5fad0255a517731f7008d (diff) |
[clipfish] improve extraction
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/clipfish.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/youtube_dl/extractor/clipfish.py b/youtube_dl/extractor/clipfish.py index 7d8eb27a1..3a47f6fa4 100644 --- a/youtube_dl/extractor/clipfish.py +++ b/youtube_dl/extractor/clipfish.py @@ -26,19 +26,29 @@ class ClipfishIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_info = self._download_json('http://www.clipfish.de/devapi/id/%s?format=json&apikey=hbbtv' % video_id, video_id)['items'][0] + video_info = self._download_json( + 'http://www.clipfish.de/devapi/id/%s?format=json&apikey=hbbtv' % video_id, + video_id)['items'][0] - formats = [{ - 'url': video_info['media_videourl_hls'].replace('de.hls.fra.clipfish.de', 'hls.fra.clipfish.de'), - 'ext': 'mp4', - 'format_id': 'hls', - }, { - 'url': video_info['media_videourl'], - 'format_id': 'mp4', - 'width': int_or_none(video_info.get('width')), - 'height': int_or_none(video_info.get('height')), - 'tbr': int_or_none(video_info.get('bitrate')), - }] + formats = [] + + m3u8_url = video_info.get('media_videourl_hls') + if m3u8_url: + formats.append({ + 'url': m3u8_url.replace('de.hls.fra.clipfish.de', 'hls.fra.clipfish.de'), + 'ext': 'mp4', + 'format_id': 'hls', + }) + + mp4_url = video_info.get('media_videourl') + if mp4_url: + formats.append({ + 'url': mp4_url, + 'format_id': 'mp4', + 'width': int_or_none(video_info.get('width')), + 'height': int_or_none(video_info.get('height')), + 'tbr': int_or_none(video_info.get('bitrate')), + }) return { 'id': video_id, |