]>
Commit | Line | Data |
---|---|---|
1b124d19 PH |
1 | from __future__ import unicode_literals |
2 | ||
1b124d19 | 3 | from .common import InfoExtractor |
1b124d19 PH |
4 | |
5 | ||
6 | class ParliamentLiveUKIE(InfoExtractor): | |
7 | IE_NAME = 'parliamentlive.tv' | |
8 | IE_DESC = 'UK parliament videos' | |
580d4119 | 9 | _VALID_URL = r'(?i)https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})' |
1b124d19 | 10 | |
580d4119 | 11 | _TESTS = [{ |
4614ad7b | 12 | 'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b', |
1b124d19 | 13 | 'info_dict': { |
fc5c47d1 | 14 | 'id': '1_af9nv9ym', |
4614ad7b RA |
15 | 'ext': 'mp4', |
16 | 'title': 'Home Affairs Committee', | |
17 | 'uploader_id': 'FFMPEG-01', | |
18 | 'timestamp': 1422696664, | |
19 | 'upload_date': '20150131', | |
1b124d19 | 20 | }, |
580d4119 YCH |
21 | }, { |
22 | 'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4', | |
23 | 'only_matching': True, | |
24 | }] | |
1b124d19 PH |
25 | |
26 | def _real_extract(self, url): | |
4614ad7b RA |
27 | video_id = self._match_id(url) |
28 | webpage = self._download_webpage( | |
29 | 'http://vodplayer.parliamentlive.tv/?mid=' + video_id, video_id) | |
30 | widget_config = self._parse_json(self._search_regex( | |
fc5c47d1 | 31 | r'(?s)kWidgetConfig\s*=\s*({.+});', |
4614ad7b | 32 | webpage, 'kaltura widget config'), video_id) |
fc5c47d1 AS |
33 | kaltura_url = 'kaltura:%s:%s' % ( |
34 | widget_config['wid'][1:], widget_config['entry_id']) | |
4614ad7b RA |
35 | event_title = self._download_json( |
36 | 'http://parliamentlive.tv/Event/GetShareVideo/' + video_id, video_id)['event']['title'] | |
1b124d19 | 37 | return { |
4614ad7b | 38 | '_type': 'url_transparent', |
4614ad7b RA |
39 | 'title': event_title, |
40 | 'description': '', | |
41 | 'url': kaltura_url, | |
42 | 'ie_key': 'Kaltura', | |
1b124d19 | 43 | } |