]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/chilloutzone.py
d4769da75e021562d4229474585e048780e9d0d2
1 from __future__
import unicode_literals
7 from .common
import InfoExtractor
8 from .youtube
import YoutubeIE
15 class ChilloutzoneIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+)\.html'
18 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
19 'md5': 'a76f3457e813ea0037e5244f509e66d1',
21 'id': 'enemene-meck-alle-katzen-weg',
23 'title': 'Enemene Meck - Alle Katzen weg',
24 'description': 'Ist das der Umkehrschluss des Niesenden Panda-Babys?',
27 'note': 'Video hosted at YouTube',
28 'url': 'http://www.chilloutzone.net/video/eine-sekunde-bevor.html',
32 'title': '16 Photos Taken 1 Second Before Disaster',
33 'description': 'md5:58a8fcf6a459fe0a08f54140f0ad1814',
34 'uploader': 'BuzzFeedVideo',
35 'uploader_id': 'BuzzFeedVideo',
36 'upload_date': '20131105',
39 'note': 'Video hosted at Vimeo',
40 'url': 'http://www.chilloutzone.net/video/icon-blending.html',
41 'md5': '2645c678b8dc4fefcc0e1b60db18dac1',
45 'title': 'The Sunday Times - Icons',
46 'description': 're:(?s)^Watch the making of - makingoficons.com.{300,}',
48 'uploader_id': 'usfilms',
49 'upload_date': '20140131'
53 def _real_extract(self
, url
):
54 mobj
= re
.match(self
._VALID
_URL
, url
)
55 video_id
= mobj
.group('id')
57 webpage
= self
._download
_webpage
(url
, video_id
)
59 base64_video_info
= self
._html
_search
_regex
(
60 r
'var cozVidData = "(.+?)";', webpage
, 'video data')
61 decoded_video_info
= base64
.b64decode(base64_video_info
.encode('utf-8')).decode('utf-8')
62 video_info_dict
= json
.loads(decoded_video_info
)
64 # get video information from dict
65 video_url
= video_info_dict
['mediaUrl']
66 description
= clean_html(video_info_dict
.get('description'))
67 title
= video_info_dict
['title']
68 native_platform
= video_info_dict
['nativePlatform']
69 native_video_id
= video_info_dict
['nativeVideoId']
70 source_priority
= video_info_dict
['sourcePriority']
72 # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
73 if native_platform
is None:
74 youtube_url
= YoutubeIE
._extract
_url
(webpage
)
76 return self
.url_result(youtube_url
, ie
=YoutubeIE
.ie_key())
78 # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
80 if source_priority
== 'native':
81 if native_platform
== 'youtube':
82 return self
.url_result(native_video_id
, ie
='Youtube')
83 if native_platform
== 'vimeo':
84 return self
.url_result(
85 'http://vimeo.com/' + native_video_id
, ie
='Vimeo')
88 raise ExtractorError('No video found')
95 'description': description
,