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