]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tva.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class TVAIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://videos\.tva\.ca/episode/(?P<id>\d+)'
15 'url': 'http://videos.tva.ca/episode/85538',
19 'title': 'Épisode du 25 janvier 2017',
20 'description': 'md5:e9e7fb5532ab37984d2dc87229cadf98',
21 'upload_date': '20170126',
22 'timestamp': 1485442329,
26 'skip_download': True,
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 video_data
= self
._download
_json
(
33 "https://d18jmrhziuoi7p.cloudfront.net/isl/api/v1/dataservice/Items('%s')" % video_id
,
35 '$expand': 'Metadata,CustomId',
36 '$select': 'Metadata,Id,Title,ShortDescription,LongDescription,CreatedDate,CustomId,AverageUserRating,Categories,ShowName',
39 metadata
= video_data
.get('Metadata', {})
42 '_type': 'url_transparent',
44 'title': video_data
['Title'],
45 'url': smuggle_url('ooyala:' + video_data
['CustomId'], {'supportedformats': 'm3u8,hds'}),
46 'description': video_data
.get('LongDescription') or video_data
.get('ShortDescription'),
47 'series': video_data
.get('ShowName'),
48 'episode': metadata
.get('EpisodeTitle'),
49 'episode_number': int_or_none(metadata
.get('EpisodeNumber')),
50 'categories': video_data
.get('Categories'),
51 'average_rating': video_data
.get('AverageUserRating'),
52 'timestamp': parse_iso8601(video_data
.get('CreatedDate')),