1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import int_or_none
9 class CultureUnpluggedIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?cultureunplugged\.com/documentary/watch-online/play/(?P<id>\d+)(?:/(?P<display_id>[^/]+))?'
12 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662/The-Next--Best-West',
13 'md5': 'ac6c093b089f7d05e79934dcb3d228fc',
16 'display_id': 'The-Next--Best-West',
18 'title': 'The Next, Best West',
19 'description': 'md5:0423cd00833dea1519cf014e9d0903b1',
20 'thumbnail': 're:^https?://.*\.jpg$',
21 'creator': 'Coldstream Creative',
26 'url': 'http://www.cultureunplugged.com/documentary/watch-online/play/53662',
27 'only_matching': True,
30 def _real_extract(self, url):
31 mobj = re.match(self._VALID_URL, url)
32 video_id = mobj.group('id')
33 display_id = mobj.group('display_id') or video_id
35 movie_data = self._download_json(
36 'http://www.cultureunplugged.com/movie-data/cu-%s.json' % video_id, display_id)
38 video_url = movie_data['url']
39 title = movie_data['title']
41 description = movie_data.get('synopsis')
42 creator = movie_data.get('producer')
43 duration = int_or_none(movie_data.get('duration'))
44 view_count = int_or_none(movie_data.get('views'))
47 'url': movie_data['%s_thumb' % size],
49 'preference': preference,
50 } for preference, size in enumerate((
51 'small', 'large')) if movie_data.get('%s_thumb' % size)]
55 'display_id': display_id,
58 'description': description,
61 'view_count': view_count,
62 'thumbnails': thumbnails,