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.

36 lines
1.3 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import int_or_none
  5. class TeleQuebecIE(InfoExtractor):
  6. _VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
  9. 'md5': 'fe95a0957e5707b1b01f5013e725c90f',
  10. 'info_dict': {
  11. 'id': '20984',
  12. 'ext': 'mp4',
  13. 'title': 'Le couronnement de New York',
  14. 'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
  15. 'upload_date': '20160220',
  16. 'timestamp': 1455965438,
  17. }
  18. }
  19. def _real_extract(self, url):
  20. media_id = self._match_id(url)
  21. media_data = self._download_json(
  22. 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id,
  23. media_id)['media']
  24. return {
  25. '_type': 'url_transparent',
  26. 'id': media_id,
  27. 'url': 'limelight:media:' + media_data['streamInfo']['sourceId'],
  28. 'title': media_data['title'],
  29. 'description': media_data.get('descriptions', [{'text': None}])[0].get('text'),
  30. 'duration': int_or_none(media_data.get('durationInMilliseconds'), 1000),
  31. 'ie_key': 'LimelightMedia',
  32. }