1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
5 class CultureUnpluggedIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?cultureunplugged\.com/documentary/watch-online/play/(?P<id>\d+)(?:/(?P<display_id>[^/]+))?'
8 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662/The-Next--Best-West',
9 'md5': 'ac6c093b089f7d05e79934dcb3d228fc',
12 'display_id': 'The-Next--Best-West',
14 'title': 'The Next, Best West',
15 'description': 'md5:0423cd00833dea1519cf014e9d0903b1',
16 'thumbnail': r
're:^https?://.*\.jpg$',
17 'creator': 'Coldstream Creative',
22 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662',
23 'only_matching': True,
26 def _real_extract(self
, url
):
27 mobj
= self
._match
_valid
_url
(url
)
28 video_id
= mobj
.group('id')
29 display_id
= mobj
.group('display_id') or video_id
31 movie_data
= self
._download
_json
(
32 f
'http://www.cultureunplugged.com/movie-data/cu-{video_id}.json', display_id
)
34 video_url
= movie_data
['url']
35 title
= movie_data
['title']
37 description
= movie_data
.get('synopsis')
38 creator
= movie_data
.get('producer')
39 duration
= int_or_none(movie_data
.get('duration'))
40 view_count
= int_or_none(movie_data
.get('views'))
43 'url': movie_data
[f
'{size}_thumb'],
45 'preference': preference
,
46 } for preference
, size
in enumerate((
47 'small', 'large')) if movie_data
.get(f
'{size}_thumb')]
51 'display_id': display_id
,
54 'description': description
,
57 'view_count': view_count
,
58 'thumbnails': thumbnails
,