]>
Commit | Line | Data |
---|---|---|
ba40a746 PH |
1 | from __future__ import unicode_literals |
2 | ||
0c7c19d6 | 3 | from .common import InfoExtractor |
ba40a746 | 4 | from ..utils import ( |
1a117a77 | 5 | int_or_none, |
240384af | 6 | unified_strdate, |
ba40a746 | 7 | ) |
0c7c19d6 PH |
8 | |
9 | ||
10 | class ClipfishIE(InfoExtractor): | |
fd5d8270 | 11 | _VALID_URL = r'https?://(?:www\.)?clipfish\.de/(?:[^/]+/)+video/(?P<id>[0-9]+)' |
0c7c19d6 | 12 | _TEST = { |
ba40a746 | 13 | 'url': 'http://www.clipfish.de/special/game-trailer/video/3966754/fifa-14-e3-2013-trailer/', |
1a117a77 | 14 | 'md5': '79bc922f3e8a9097b3d68a93780fd475', |
ba40a746 PH |
15 | 'info_dict': { |
16 | 'id': '3966754', | |
17 | 'ext': 'mp4', | |
18 | 'title': 'FIFA 14 - E3 2013 Trailer', | |
240384af | 19 | 'description': 'Video zu FIFA 14: E3 2013 Trailer', |
fd5d8270 | 20 | 'upload_date': '20130611', |
ba40a746 | 21 | 'duration': 82, |
240384af | 22 | 'view_count': int, |
1a117a77 | 23 | } |
0c7c19d6 PH |
24 | } |
25 | ||
26 | def _real_extract(self, url): | |
1a117a77 | 27 | video_id = self._match_id(url) |
fd5d8270 | 28 | |
bee4c557 | 29 | video_info = self._download_json( |
30 | 'http://www.clipfish.de/devapi/id/%s?format=json&apikey=hbbtv' % video_id, | |
31 | video_id)['items'][0] | |
fd5d8270 | 32 | |
bee4c557 | 33 | formats = [] |
34 | ||
35 | m3u8_url = video_info.get('media_videourl_hls') | |
36 | if m3u8_url: | |
37 | formats.append({ | |
38 | 'url': m3u8_url.replace('de.hls.fra.clipfish.de', 'hls.fra.clipfish.de'), | |
39 | 'ext': 'mp4', | |
40 | 'format_id': 'hls', | |
41 | }) | |
42 | ||
43 | mp4_url = video_info.get('media_videourl') | |
44 | if mp4_url: | |
45 | formats.append({ | |
46 | 'url': mp4_url, | |
47 | 'format_id': 'mp4', | |
48 | 'width': int_or_none(video_info.get('width')), | |
49 | 'height': int_or_none(video_info.get('height')), | |
50 | 'tbr': int_or_none(video_info.get('bitrate')), | |
51 | }) | |
fd5d8270 | 52 | |
0c7c19d6 PH |
53 | return { |
54 | 'id': video_id, | |
240384af | 55 | 'title': video_info['title'], |
56 | 'description': video_info.get('descr'), | |
1a117a77 | 57 | 'formats': formats, |
240384af | 58 | 'thumbnail': video_info.get('media_content_thumbnail_large') or video_info.get('media_thumbnail'), |
59 | 'duration': int_or_none(video_info.get('media_length')), | |
60 | 'upload_date': unified_strdate(video_info.get('pubDate')), | |
61 | 'view_count': int_or_none(video_info.get('media_views')) | |
0c7c19d6 | 62 | } |