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.

41 lines
1.2 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 TouTvIE(InfoExtractor):
  6. IE_NAME = 'tou.tv'
  7. _VALID_URL = r'https?://ici\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+/S[0-9]+E[0-9]+)'
  8. _TEST = {
  9. 'url': 'http://ici.tou.tv/garfield-tout-court/S2015E17',
  10. 'info_dict': {
  11. 'id': '122017',
  12. 'ext': 'mp4',
  13. 'title': 'Saison 2015 Épisode 17',
  14. 'description': 'La photo de famille 2',
  15. 'upload_date': '20100717',
  16. },
  17. 'params': {
  18. # m3u8 download
  19. 'skip_download': True,
  20. },
  21. }
  22. def _real_extract(self, url):
  23. path = self._match_id(url)
  24. metadata = self._download_json('http://ici.tou.tv/presentation/%s' % path, path)
  25. video_id = metadata['IdMedia']
  26. details = metadata['Details']
  27. title = details['OriginalTitle']
  28. return {
  29. '_type': 'url_transparent',
  30. 'url': 'radiocanada:%s:%s' % (metadata.get('AppCode', 'toutv'), video_id),
  31. 'id': video_id,
  32. 'title': title,
  33. 'thumbnail': details.get('ImageUrl'),
  34. 'duration': int_or_none(details.get('LengthInSeconds')),
  35. }