]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/toutv.py
Update Standards-Version to 3.9.8 (no changes required).
[youtubedl] / youtube_dl / extractor / toutv.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import int_or_none
6
7
8 class TouTvIE(InfoExtractor):
9 IE_NAME = 'tou.tv'
10 _VALID_URL = r'https?://ici\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+/S[0-9]+E[0-9]+)'
11
12 _TEST = {
13 'url': 'http://ici.tou.tv/garfield-tout-court/S2015E17',
14 'info_dict': {
15 'id': '122017',
16 'ext': 'mp4',
17 'title': 'Saison 2015 Épisode 17',
18 'description': 'La photo de famille 2',
19 'upload_date': '20100717',
20 },
21 'params': {
22 # m3u8 download
23 'skip_download': True,
24 },
25 }
26
27 def _real_extract(self, url):
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']
33
34 return {
35 '_type': 'url_transparent',
36 'url': 'radiocanada:%s:%s' % (metadata.get('AppCode', 'toutv'), video_id),
37 'id': video_id,
38 'title': title,
39 'thumbnail': details.get('ImageUrl'),
40 'duration': int_or_none(details.get('LengthInSeconds')),
41 }