]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telequebec.py
82d73c31d55c55dfb7cdf40f593265806f3fdb89
[youtubedl] / youtube_dl / extractor / telequebec.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 int_or_none,
7 smuggle_url,
8 )
9
10
11 class TeleQuebecIE(InfoExtractor):
12 _VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
13 _TEST = {
14 'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
15 'md5': 'fe95a0957e5707b1b01f5013e725c90f',
16 'info_dict': {
17 'id': '20984',
18 'ext': 'mp4',
19 'title': 'Le couronnement de New York',
20 'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
21 'upload_date': '20160220',
22 'timestamp': 1455965438,
23 }
24 }
25
26 def _real_extract(self, url):
27 media_id = self._match_id(url)
28 media_data = self._download_json(
29 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id,
30 media_id)['media']
31 return {
32 '_type': 'url_transparent',
33 'id': media_id,
34 'url': smuggle_url('limelight:media:' + media_data['streamInfo']['sourceId'], {'geo_countries': ['CA']}),
35 'title': media_data['title'],
36 'description': media_data.get('descriptions', [{'text': None}])[0].get('text'),
37 'duration': int_or_none(media_data.get('durationInMilliseconds'), 1000),
38 'ie_key': 'LimelightMedia',
39 }