]>
Commit | Line | Data |
---|---|---|
6f4fc566 | 1 | import base64 |
46a073bf AS |
2 | |
3 | from .common import InfoExtractor | |
d914d9d1 PH |
4 | from ..utils import ( |
5 | clean_html, | |
6f4fc566 | 6 | int_or_none, |
7 | traverse_obj, | |
d914d9d1 | 8 | ) |
46a073bf | 9 | |
46a073bf AS |
10 | |
11 | class ChilloutzoneIE(InfoExtractor): | |
6f4fc566 | 12 | _VALID_URL = r'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w-]+)\.html' |
8bc6c8e3 | 13 | _TESTS = [{ |
6f4fc566 | 14 | 'url': 'https://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html', |
cd8662de AS |
15 | 'md5': 'a76f3457e813ea0037e5244f509e66d1', |
16 | 'info_dict': { | |
17 | 'id': 'enemene-meck-alle-katzen-weg', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Enemene Meck - Alle Katzen weg', | |
4a9540b6 | 20 | 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?', |
6f4fc566 | 21 | 'duration': 24, |
cd8662de | 22 | }, |
8bc6c8e3 PH |
23 | }, { |
24 | 'note': 'Video hosted at YouTube', | |
6f4fc566 | 25 | 'url': 'https://www.chilloutzone.net/video/eine-sekunde-bevor.html', |
8bc6c8e3 PH |
26 | 'info_dict': { |
27 | 'id': '1YVQaAgHyRU', | |
28 | 'ext': 'mp4', | |
29 | 'title': '16 Photos Taken 1 Second Before Disaster', | |
30 | 'description': 'md5:58a8fcf6a459fe0a08f54140f0ad1814', | |
31 | 'uploader': 'BuzzFeedVideo', | |
6f4fc566 | 32 | 'uploader_id': '@BuzzFeedVideo', |
8bc6c8e3 | 33 | 'upload_date': '20131105', |
6f4fc566 | 34 | 'availability': 'public', |
35 | 'thumbnail': 'https://i.ytimg.com/vi/1YVQaAgHyRU/maxresdefault.jpg', | |
36 | 'tags': 'count:41', | |
37 | 'like_count': int, | |
38 | 'playable_in_embed': True, | |
39 | 'channel_url': 'https://www.youtube.com/channel/UCpko_-a4wgz2u_DgDgd9fqA', | |
40 | 'chapters': 'count:6', | |
41 | 'live_status': 'not_live', | |
42 | 'view_count': int, | |
43 | 'categories': ['Entertainment'], | |
44 | 'age_limit': 0, | |
45 | 'channel_id': 'UCpko_-a4wgz2u_DgDgd9fqA', | |
46 | 'duration': 100, | |
47 | 'uploader_url': 'http://www.youtube.com/@BuzzFeedVideo', | |
48 | 'channel_follower_count': int, | |
49 | 'channel': 'BuzzFeedVideo', | |
8bc6c8e3 PH |
50 | }, |
51 | }, { | |
6f4fc566 | 52 | 'url': 'https://www.chilloutzone.net/video/icon-blending.html', |
53 | 'md5': '2f9d6850ec567b24f0f4fa143b9aa2f9', | |
8bc6c8e3 | 54 | 'info_dict': { |
6f4fc566 | 55 | 'id': 'LLNkHpSjBfc', |
8bc6c8e3 | 56 | 'ext': 'mp4', |
6f4fc566 | 57 | 'title': 'The Sunday Times Making of Icons', |
58 | 'description': 'md5:b9259fcf63a1669e42001e5db677f02a', | |
59 | 'uploader': 'MadFoxUA', | |
60 | 'uploader_id': '@MadFoxUA', | |
61 | 'upload_date': '20140204', | |
62 | 'channel_id': 'UCSZa9Y6-Vl7c11kWMcbAfCw', | |
63 | 'channel_url': 'https://www.youtube.com/channel/UCSZa9Y6-Vl7c11kWMcbAfCw', | |
64 | 'comment_count': int, | |
65 | 'uploader_url': 'http://www.youtube.com/@MadFoxUA', | |
66 | 'duration': 66, | |
67 | 'live_status': 'not_live', | |
68 | 'channel_follower_count': int, | |
69 | 'playable_in_embed': True, | |
70 | 'view_count': int, | |
71 | 'like_count': int, | |
72 | 'thumbnail': 'https://i.ytimg.com/vi/LLNkHpSjBfc/maxresdefault.jpg', | |
73 | 'categories': ['Comedy'], | |
74 | 'availability': 'public', | |
75 | 'tags': [], | |
76 | 'channel': 'MadFoxUA', | |
77 | 'age_limit': 0, | |
78 | }, | |
79 | }, { | |
80 | 'url': 'https://www.chilloutzone.net/video/ordentlich-abgeschuettelt.html', | |
81 | 'info_dict': { | |
82 | 'id': 'ordentlich-abgeschuettelt', | |
83 | 'ext': 'mp4', | |
84 | 'title': 'Ordentlich abgeschüttelt', | |
85 | 'description': 'md5:d41541966b75d3d1e8ea77a94ea0d329', | |
86 | 'duration': 18, | |
8bc6c8e3 PH |
87 | }, |
88 | }] | |
46a073bf AS |
89 | |
90 | def _real_extract(self, url): | |
6f4fc566 | 91 | video_id = self._match_id(url) |
4a9540b6 | 92 | webpage = self._download_webpage(url, video_id) |
6f4fc566 | 93 | b64_data = self._html_search_regex( |
94 | r'var cozVidData\s*=\s*"([^"]+)"', webpage, 'video data') | |
95 | info = self._parse_json(base64.b64decode(b64_data).decode(), video_id) | |
cd8662de | 96 | |
6f4fc566 | 97 | video_url = info.get('mediaUrl') |
98 | native_platform = info.get('nativePlatform') | |
cd8662de | 99 | |
6f4fc566 | 100 | if native_platform and info.get('sourcePriority') == 'native': |
101 | native_video_id = info['nativeVideoId'] | |
cd8662de | 102 | if native_platform == 'youtube': |
6f4fc566 | 103 | return self.url_result(native_video_id, 'Youtube') |
104 | elif native_platform == 'vimeo': | |
105 | return self.url_result(f'https://vimeo.com/{native_video_id}', 'Vimeo') | |
46a073bf | 106 | |
6f4fc566 | 107 | elif not video_url: |
108 | # Possibly a standard youtube embed? | |
109 | # TODO: Investigate if site still does this (there are no tests for it) | |
110 | return self.url_result(url, 'Generic') | |
46a073bf | 111 | |
4a9540b6 PH |
112 | return { |
113 | 'id': video_id, | |
114 | 'url': video_url, | |
115 | 'ext': 'mp4', | |
6f4fc566 | 116 | **traverse_obj(info, { |
117 | 'title': 'title', | |
118 | 'description': ('description', {clean_html}), | |
119 | 'duration': ('videoLength', {int_or_none}), | |
120 | 'width': ('videoWidth', {int_or_none}), | |
121 | 'height': ('videoHeight', {int_or_none}), | |
122 | }), | |
4a9540b6 | 123 | } |