1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-27 19:36:50 +01:00

[clipfish] improve extraction

This commit is contained in:
remitamine 2015-12-04 16:38:05 +01:00
parent 96929dd1e8
commit bee4c5571a

View File

@ -26,19 +26,29 @@ class ClipfishIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(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 = [{ formats = []
'url': video_info['media_videourl_hls'].replace('de.hls.fra.clipfish.de', 'hls.fra.clipfish.de'),
'ext': 'mp4', m3u8_url = video_info.get('media_videourl_hls')
'format_id': 'hls', if m3u8_url:
}, { formats.append({
'url': video_info['media_videourl'], 'url': m3u8_url.replace('de.hls.fra.clipfish.de', 'hls.fra.clipfish.de'),
'format_id': 'mp4', 'ext': 'mp4',
'width': int_or_none(video_info.get('width')), 'format_id': 'hls',
'height': int_or_none(video_info.get('height')), })
'tbr': int_or_none(video_info.get('bitrate')),
}] 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 { return {
'id': video_id, 'id': video_id,