]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telequebec.py
6965c127b3351122e894608c8a41ac3e79aff58d
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
13 class TeleQuebecBaseIE(InfoExtractor
):
15 def _limelight_result(media_id
):
17 '_type': 'url_transparent',
19 'limelight:media:' + media_id
, {'geo_countries': ['CA']}),
20 'ie_key': 'LimelightMedia',
24 class TeleQuebecIE(TeleQuebecBaseIE
):
25 _VALID_URL
= r
'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
27 # available till 01.01.2023
28 'url': 'http://zonevideo.telequebec.tv/media/37578/un-petit-choc-et-puis-repart/un-chef-a-la-cabane',
30 'id': '577116881b4b439084e6b1cf4ef8b1b3',
32 'title': 'Un petit choc et puis repart!',
33 'description': 'md5:b04a7e6b3f74e32d7b294cffe8658374',
34 'upload_date': '20180222',
35 'timestamp': 1519326631,
38 'skip_download': True,
42 'url': 'http://zonevideo.telequebec.tv/media/30261',
43 'only_matching': True,
46 def _real_extract(self
, url
):
47 media_id
= self
._match
_id
(url
)
49 media_data
= self
._download
_json
(
50 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id
,
53 info
= self
._limelight
_result
(media_data
['streamInfo']['sourceId'])
55 'title': media_data
.get('title'),
56 'description': try_get(
57 media_data
, lambda x
: x
['descriptions'][0]['text'], compat_str
),
58 'duration': int_or_none(
59 media_data
.get('durationInMilliseconds'), 1000),
64 class TeleQuebecEmissionIE(TeleQuebecBaseIE
):
68 [^/]+\.telequebec\.tv/emissions/|
69 (?:www\.)?telequebec\.tv/
74 'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente',
76 'id': '66648a6aef914fe3badda25e81a4d50a',
78 'title': "Des soins esthétiques à 377 % d'intérêts annuels, ça vous tente?",
79 'description': 'md5:369e0d55d0083f1fc9b71ffb640ea014',
80 'upload_date': '20171024',
81 'timestamp': 1508862118,
84 'skip_download': True,
87 'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression',
88 'only_matching': True,
90 'url': 'http://www.telequebec.tv/masha-et-michka/epi059masha-et-michka-3-053-078',
91 'only_matching': True,
93 'url': 'http://www.telequebec.tv/documentaire/bebes-sur-mesure/',
94 'only_matching': True,
97 def _real_extract(self
, url
):
98 display_id
= self
._match
_id
(url
)
100 webpage
= self
._download
_webpage
(url
, display_id
)
102 media_id
= self
._search
_regex
(
103 r
'mediaUID\s*:\s*["\'][Ll
]imelight_(?P
<id>[a
-z0
-9]{32}
)', webpage,
106 info = self._limelight_result(media_id)
108 'title
': self._og_search_title(webpage, default=None),
109 'description
': self._og_search_description(webpage, default=None),
114 class TeleQuebecLiveIE(InfoExtractor):
115 _VALID_URL = r'https?
://zonevideo\
.telequebec\
.tv
/(?P
<id>endirect
)'
117 'url
': 'http
://zonevideo
.telequebec
.tv
/endirect
/',
121 'title
': 're
:^Télé
-Québec
- En direct
[0-9]{4}
-[0-9]{2}
-[0-9]{2}
[0-9]{2}
:[0-9]{2}$
',
125 'skip_download
': True,
129 def _real_extract(self, url):
130 video_id = self._match_id(url)
133 webpage = self._download_webpage(
134 'https
://player
.telequebec
.tv
/Tq_VideoPlayer
.js
', video_id,
137 m3u8_url = self._search_regex(
138 r'm3U8Url\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
139 'm3u8 url', default=None, group='url')
141 m3u8_url = 'https://teleqmmd.mmdlive.lldns.net/teleqmmd/f386e3b206814e1f8c8c1c71c0f8e748/manifest.m3u8'
142 formats = self._extract_m3u8_formats(
143 m3u8_url, video_id, 'mp4', m3u8_id='hls')
144 self._sort_formats(formats)
148 'title': self._live_title('Télé-Québec - En direct'),