2013-11-20 05:13:19 +00:00
|
|
|
# coding: utf-8
|
2014-02-05 12:02:03 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2013-11-20 05:13:19 +00:00
|
|
|
from .common import InfoExtractor
|
2016-05-24 15:06:02 +00:00
|
|
|
from ..utils import int_or_none
|
2013-11-20 05:13:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TouTvIE(InfoExtractor):
|
2014-02-05 12:02:03 +00:00
|
|
|
IE_NAME = 'tou.tv'
|
2016-05-24 15:06:02 +00:00
|
|
|
_VALID_URL = r'https?://ici\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+/S[0-9]+E[0-9]+)'
|
2013-11-20 05:13:19 +00:00
|
|
|
|
|
|
|
_TEST = {
|
2016-05-24 15:06:02 +00:00
|
|
|
'url': 'http://ici.tou.tv/garfield-tout-court/S2015E17',
|
2014-02-05 12:02:03 +00:00
|
|
|
'info_dict': {
|
2016-05-24 15:06:02 +00:00
|
|
|
'id': '122017',
|
2015-02-01 14:01:33 +00:00
|
|
|
'ext': 'mp4',
|
2016-05-24 15:06:02 +00:00
|
|
|
'title': 'Saison 2015 Épisode 17',
|
|
|
|
'description': 'La photo de famille 2',
|
|
|
|
'upload_date': '20100717',
|
2013-11-20 05:13:19 +00:00
|
|
|
},
|
2014-02-05 12:02:03 +00:00
|
|
|
'params': {
|
2016-05-24 15:06:02 +00:00
|
|
|
# m3u8 download
|
|
|
|
'skip_download': True,
|
2013-11-20 05:13:19 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-05-24 15:06:02 +00:00
|
|
|
path = self._match_id(url)
|
|
|
|
metadata = self._download_json('http://ici.tou.tv/presentation/%s' % path, path)
|
|
|
|
video_id = metadata['IdMedia']
|
|
|
|
details = metadata['Details']
|
|
|
|
title = details['OriginalTitle']
|
2013-11-20 05:13:19 +00:00
|
|
|
|
|
|
|
return {
|
2016-05-24 15:06:02 +00:00
|
|
|
'_type': 'url_transparent',
|
|
|
|
'url': 'radiocanada:%s:%s' % (metadata.get('AppCode', 'toutv'), video_id),
|
2013-11-20 05:13:19 +00:00
|
|
|
'id': video_id,
|
2016-05-24 15:06:02 +00:00
|
|
|
'title': title,
|
|
|
|
'thumbnail': details.get('ImageUrl'),
|
|
|
|
'duration': int_or_none(details.get('LengthInSeconds')),
|
2013-11-20 05:13:19 +00:00
|
|
|
}
|