]>
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'
13 'url': 'http://www.chilloutzone.net/video/enemene-meck-alle-katzen-weg.html',
14 'md5': 'a76f3457e813ea0037e5244f509e66d1',
16 'id': 'enemene-meck-alle-katzen-weg',
18 'title': 'Enemene Meck - Alle Katzen weg',
22 def _real_extract(self
, url
):
23 mobj
= re
.match(self
._VALID
_URL
, url
)
24 video_id
= mobj
.group('id')
26 webpage_url
= 'http://www.chilloutzone.net/video/' + video_id
+ '.html'
28 # Log that we are starting to download the page
29 self
.report_download_webpage(webpage_url
)
30 webpage
= self
._download
_webpage
(webpage_url
, video_id
)
32 # Log that we are starting to parse the page
33 self
.report_extraction(video_id
)
34 # Find base64 decoded file info
35 base64_video_info
= self
._html
_search
_regex
(r
'var cozVidData = "(.+?)";', webpage
, u
'video Data')
36 # decode string and find video file
37 decoded_video_info
= base64
.b64decode(base64_video_info
).decode("utf-8")
38 video_info_dict
= json
.loads(decoded_video_info
)
39 # get video information from dict
40 media_url
= video_info_dict
['mediaUrl']
41 description
= video_info_dict
['description']
42 title
= video_info_dict
['title']
43 native_platform
= video_info_dict
['nativePlatform']
44 native_video_id
= video_info_dict
['nativeVideoId']
45 source_priority
= video_info_dict
['sourcePriority']
48 # Start video extraction
50 # If nativePlatform is None a fallback mechanism is used (i.e. youtube embed)
51 if native_platform
== None:
52 # Look for other video urls
53 video_url
= self
._html
_search
_regex
(r
'<iframe.* src="(.+?)".*', webpage
, u
'fallback Video URL')
54 if 'youtube' in video_url
:
55 self
.to_screen(u
'Youtube video detected:')
56 return self
.url_result(video_url
, ie
='Youtube')
58 # For debugging purposes
59 #print video_info_dict
60 #print native_platform
61 #print native_video_id
62 #print source_priority
65 # Non Fallback: Decide to use native source (e.g. youtube or vimeo) or
67 if source_priority
== 'native':
68 if native_platform
== 'youtube':
69 self
.to_screen(u
'Youtube video detected:')
70 video_url
= 'https://www.youtube.com/watch?v=' + native_video_id
71 return self
.url_result(video_url
, ie
='Youtube')
72 if native_platform
== 'vimeo':
73 self
.to_screen(u
'Vimeo video detected:')
74 video_url
= 'http://vimeo.com/' + native_video_id
75 return self
.url_result(video_url
, ie
='Vimeo')
77 # No redirect, use coz media url
79 if video_url
.endswith('.mp4') == False:
80 self
.report_warning(u
'Url does not contain a video container')
89 'description': description
,