You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class ParliamentLiveUKIE(InfoExtractor):
  4. IE_NAME = 'parliamentlive.tv'
  5. IE_DESC = 'UK parliament videos'
  6. _VALID_URL = r'https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
  7. _TEST = {
  8. 'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
  9. 'info_dict': {
  10. 'id': 'c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
  11. 'ext': 'mp4',
  12. 'title': 'Home Affairs Committee',
  13. 'uploader_id': 'FFMPEG-01',
  14. 'timestamp': 1422696664,
  15. 'upload_date': '20150131',
  16. },
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(
  21. 'http://vodplayer.parliamentlive.tv/?mid=' + video_id, video_id)
  22. widget_config = self._parse_json(self._search_regex(
  23. r'kWidgetConfig\s*=\s*({.+});',
  24. webpage, 'kaltura widget config'), video_id)
  25. kaltura_url = 'kaltura:%s:%s' % (widget_config['wid'][1:], widget_config['entry_id'])
  26. event_title = self._download_json(
  27. 'http://parliamentlive.tv/Event/GetShareVideo/' + video_id, video_id)['event']['title']
  28. return {
  29. '_type': 'url_transparent',
  30. 'id': video_id,
  31. 'title': event_title,
  32. 'description': '',
  33. 'url': kaltura_url,
  34. 'ie_key': 'Kaltura',
  35. }