]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/chilloutzone.py
3 from .common
import InfoExtractor
4 from .youtube
import YoutubeIE
5 from ..compat
import compat_b64decode
12 class ChilloutzoneIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+)\.html'
15 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
16 'md5': 'a76f3457e813ea0037e5244f509e66d1',
18 'id': 'enemene-meck-alle-katzen-weg',
20 'title': 'Enemene Meck - Alle Katzen weg',
21 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?',
24 'note': 'Video hosted at YouTube',
25 'url': 'http://www.chilloutzone.net/video/eine-sekunde-bevor.html',
29 'title': '16 Photos Taken 1 Second Before Disaster',
30 'description': 'md5:58a8fcf6a459fe0a08f54140f0ad1814',
31 'uploader': 'BuzzFeedVideo',
32 'uploader_id': 'BuzzFeedVideo',
33 'upload_date': '20131105',
36 'note': 'Video hosted at Vimeo',
37 'url': 'http://www.chilloutzone.net/video/icon-blending.html',
38 'md5': '2645c678b8dc4fefcc0e1b60db18dac1',
42 'title': 'The Sunday Times - Icons',
43 'description': 're:(?s)^Watch the making of - makingoficons.com.{300,}',
45 'uploader_id': 'usfilms',
46 'upload_date': '20140131'
50 def _real_extract(self
, url
):
51 mobj
= self
._match
_valid
_url
(url
)
52 video_id
= mobj
.group('id')
54 webpage
= self
._download
_webpage
(url
, video_id
)
56 base64_video_info
= self
._html
_search
_regex
(
57 r
'var cozVidData = "(.+?)";', webpage
, 'video data')
58 decoded_video_info
= compat_b64decode(base64_video_info
).decode('utf-8')
59 video_info_dict
= json
.loads(decoded_video_info
)
61 # get video information from dict
62 video_url
= video_info_dict
['mediaUrl']
63 description
= clean_html(video_info_dict
.get('description'))
64 title
= video_info_dict
['title']
65 native_platform
= video_info_dict
['nativePlatform']
66 native_video_id
= video_info_dict
['nativeVideoId']
67 source_priority
= video_info_dict
['sourcePriority']
69 # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
70 if native_platform
is None:
71 youtube_url
= YoutubeIE
._extract
_url
(webpage
)
73 return self
.url_result(youtube_url
, ie
=YoutubeIE
.ie_key())
75 # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
77 if source_priority
== 'native':
78 if native_platform
== 'youtube':
79 return self
.url_result(native_video_id
, ie
='Youtube')
80 if native_platform
== 'vimeo':
81 return self
.url_result(
82 'http://vimeo.com/' + native_video_id
, ie
='Vimeo')
85 raise ExtractorError('No video found')
92 'description': description
,