]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/cultureunplugged.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class CultureUnpluggedIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?cultureunplugged\.com/documentary/watch-online/play/(?P<id>\d+)(?:/(?P<display_id>[^/]+))?'
16 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662/The-Next--Best-West',
17 'md5': 'ac6c093b089f7d05e79934dcb3d228fc',
20 'display_id': 'The-Next--Best-West',
22 'title': 'The Next, Best West',
23 'description': 'md5:0423cd00833dea1519cf014e9d0903b1',
24 'thumbnail': 're:^https?://.*\.jpg$',
25 'creator': 'Coldstream Creative',
30 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662',
31 'only_matching': True,
34 def _real_extract(self
, url
):
35 mobj
= re
.match(self
._VALID
_URL
, url
)
36 video_id
= mobj
.group('id')
37 display_id
= mobj
.group('display_id') or video_id
39 # request setClientTimezone.php to get PHPSESSID cookie which is need to get valid json data in the next request
40 self
._request
_webpage
(HEADRequest(
41 'http://www.cultureunplugged.com/setClientTimezone.php?timeOffset=%d' % -(time
.timezone
/ 3600)), display_id
)
42 movie_data
= self
._download
_json
(
43 'http://www.cultureunplugged.com/movie-data/cu-%s.json' % video_id
, display_id
)
45 video_url
= movie_data
['url']
46 title
= movie_data
['title']
48 description
= movie_data
.get('synopsis')
49 creator
= movie_data
.get('producer')
50 duration
= int_or_none(movie_data
.get('duration'))
51 view_count
= int_or_none(movie_data
.get('views'))
54 'url': movie_data
['%s_thumb' % size
],
56 'preference': preference
,
57 } for preference
, size
in enumerate((
58 'small', 'large')) if movie_data
.get('%s_thumb' % size
)]
62 'display_id': display_id
,
65 'description': description
,
68 'view_count': view_count
,
69 'thumbnails': thumbnails
,