]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/chilloutzone.py
6 from .common
import InfoExtractor
8 video_container
= ('.mp4', '.mkv', '.flv')
10 class ChilloutzoneIE(InfoExtractor
):
11 _VALID_URL
= r
'(?:https?://)?(?:www\.)?chilloutzone\.net/video/(?P<id>[\w|-]+).html'
14 u
'url': u
'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
15 u
'file': u
'18088-enemene-meck-alle-katzen-weg.mp4',
16 u
'md5': u
'a76f3457e813ea0037e5244f509e66d1',
20 u
"title": u
"Enemene Meck - Alle Katzen weg"
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 video_id
= mobj
.group('id')
28 webpage_url
= 'http://www.chilloutzone.net/video/' + video_id
+ '.html'
30 # Log that we are starting to download the page
31 self
.report_download_webpage(webpage_url
)
32 webpage
= self
._download
_webpage
(webpage_url
, video_id
)
36 # Log that we are starting to parse the page
37 self
.report_extraction(video_id
)
38 # Find base64 decoded file info
39 base64_video_info
= self
._html
_search
_regex
(r
'var cozVidData = "(.+?)";', webpage
, u
'video Data')
40 # decode string and find video file
41 decoded_video_info
= base64
.b64decode(base64_video_info
)
42 video_info_dict
= json
.loads(decoded_video_info
)
43 # get video information from dict
44 media_url
= video_info_dict
['mediaUrl']
45 description
= video_info_dict
['description']
46 title
= video_info_dict
['title']
47 native_platform
= video_info_dict
['nativePlatform']
48 native_video_id
= video_info_dict
['nativeVideoId']
49 source_priority
= video_info_dict
['sourcePriority']
52 # Start video extraction
54 # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
55 if native_platform
== None:
56 # Look for other video urls
57 video_url
= self
._html
_search
_regex
(r
'<iframe.* src="(.+?)".*', webpage
, u
'fallback Video URL')
58 if 'youtube' in video_url
:
59 self
.to_screen(u
'Youtube video detected:')
61 return self
.url_result(video_url
, ie
='Youtube')
63 # For debugging purposes
64 #print video_info_dict
65 #print native_platform
66 #print native_video_id
67 #print source_priority
70 # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
72 if source_priority
== 'native':
73 if native_platform
== 'youtube':
74 self
.to_screen(u
'Youtube video detected:')
75 video_url
= 'https://www.youtube.com/watch?v=' + native_video_id
77 return self
.url_result(video_url
, ie
='Youtube')
78 if native_platform
== 'vimeo':
79 self
.to_screen(u
'Vimeo video detected:')
80 video_url
= 'http://vimeo.com/' + native_video_id
82 return self
.url_result(video_url
, ie
='Vimeo')
84 # No redirect, use coz media url
86 if video_url
.endswith('.mp4') == False:
87 self
.report_warning(u
'Url does not contain a video container')
96 'description': description