]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/parliamentliveuk.py
debian/{compat,control}: Update to debhelper compatibility level 12.
[youtubedl] / youtube_dl / extractor / parliamentliveuk.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class ParliamentLiveUKIE(InfoExtractor):
7 IE_NAME = 'parliamentlive.tv'
8 IE_DESC = 'UK parliament videos'
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})'
10
11 _TESTS = [{
12 'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
13 'info_dict': {
14 'id': '1_af9nv9ym',
15 'ext': 'mp4',
16 'title': 'Home Affairs Committee',
17 'uploader_id': 'FFMPEG-01',
18 'timestamp': 1422696664,
19 'upload_date': '20150131',
20 },
21 }, {
22 'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
23 'only_matching': True,
24 }]
25
26 def _real_extract(self, url):
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(
31 r'(?s)kWidgetConfig\s*=\s*({.+});',
32 webpage, 'kaltura widget config'), video_id)
33 kaltura_url = 'kaltura:%s:%s' % (
34 widget_config['wid'][1:], widget_config['entry_id'])
35 event_title = self._download_json(
36 'http://parliamentlive.tv/Event/GetShareVideo/' + video_id, video_id)['event']['title']
37 return {
38 '_type': 'url_transparent',
39 'title': event_title,
40 'description': '',
41 'url': kaltura_url,
42 'ie_key': 'Kaltura',
43 }