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.

43 lines
1.6 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'(?i)https?://(?:www\.)?parliamentlive\.tv/Event/Index/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
  7. _TESTS = [{
  8. 'url': 'http://parliamentlive.tv/Event/Index/c1e9d44d-fd6c-4263-b50f-97ed26cc998b',
  9. 'info_dict': {
  10. 'id': '1_af9nv9ym',
  11. 'ext': 'mp4',
  12. 'title': 'Home Affairs Committee',
  13. 'uploader_id': 'FFMPEG-01',
  14. 'timestamp': 1422696664,
  15. 'upload_date': '20150131',
  16. },
  17. }, {
  18. 'url': 'http://parliamentlive.tv/event/index/3f24936f-130f-40bf-9a5d-b3d6479da6a4',
  19. 'only_matching': True,
  20. }]
  21. def _real_extract(self, url):
  22. video_id = self._match_id(url)
  23. webpage = self._download_webpage(
  24. 'http://vodplayer.parliamentlive.tv/?mid=' + video_id, video_id)
  25. widget_config = self._parse_json(self._search_regex(
  26. r'(?s)kWidgetConfig\s*=\s*({.+});',
  27. webpage, 'kaltura widget config'), video_id)
  28. kaltura_url = 'kaltura:%s:%s' % (
  29. widget_config['wid'][1:], widget_config['entry_id'])
  30. event_title = self._download_json(
  31. 'http://parliamentlive.tv/Event/GetShareVideo/' + video_id, video_id)['event']['title']
  32. return {
  33. '_type': 'url_transparent',
  34. 'title': event_title,
  35. 'description': '',
  36. 'url': kaltura_url,
  37. 'ie_key': 'Kaltura',
  38. }