]>
Commit | Line | Data |
---|---|---|
59040888 | 1 | # coding: utf-8 |
8c820776 S |
2 | from __future__ import unicode_literals |
3 | ||
59040888 | 4 | from .common import InfoExtractor |
882af14d | 5 | from ..utils import int_or_none |
59040888 PH |
6 | |
7 | ||
8 | class TouTvIE(InfoExtractor): | |
8c820776 | 9 | IE_NAME = 'tou.tv' |
882af14d | 10 | _VALID_URL = r'https?://ici\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+/S[0-9]+E[0-9]+)' |
59040888 PH |
11 | |
12 | _TEST = { | |
882af14d | 13 | 'url': 'http://ici.tou.tv/garfield-tout-court/S2015E17', |
8c820776 | 14 | 'info_dict': { |
882af14d | 15 | 'id': '122017', |
057c0609 | 16 | 'ext': 'mp4', |
882af14d | 17 | 'title': 'Saison 2015 Épisode 17', |
18 | 'description': 'La photo de famille 2', | |
19 | 'upload_date': '20100717', | |
59040888 | 20 | }, |
8c820776 | 21 | 'params': { |
882af14d | 22 | # m3u8 download |
23 | 'skip_download': True, | |
59040888 | 24 | }, |
59040888 PH |
25 | } |
26 | ||
27 | def _real_extract(self, url): | |
882af14d | 28 | path = self._match_id(url) |
29 | metadata = self._download_json('http://ici.tou.tv/presentation/%s' % path, path) | |
30 | video_id = metadata['IdMedia'] | |
31 | details = metadata['Details'] | |
32 | title = details['OriginalTitle'] | |
59040888 PH |
33 | |
34 | return { | |
882af14d | 35 | '_type': 'url_transparent', |
36 | 'url': 'radiocanada:%s:%s' % (metadata.get('AppCode', 'toutv'), video_id), | |
59040888 | 37 | 'id': video_id, |
882af14d | 38 | 'title': title, |
39 | 'thumbnail': details.get('ImageUrl'), | |
40 | 'duration': int_or_none(details.get('LengthInSeconds')), | |
59040888 | 41 | } |