1 from .common
import InfoExtractor
10 class TeleQuebecBaseIE(InfoExtractor
):
11 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
14 def _brightcove_result(brightcove_id
, player_id
, account_id
='6150020952001'):
16 '_type': 'url_transparent',
17 'url': smuggle_url(TeleQuebecBaseIE
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, brightcove_id
), {'geo_countries': ['CA']}),
18 'ie_key': 'BrightcoveNew',
22 class TeleQuebecIE(TeleQuebecBaseIE
):
26 zonevideo\.telequebec\.tv/media|
27 coucou\.telequebec\.tv/videos
31 # available till 01.01.2023
32 'url': 'http://zonevideo.telequebec.tv/media/37578/un-petit-choc-et-puis-repart/un-chef-a-la-cabane',
34 'id': '6155972771001',
36 'title': 'Un petit choc et puis repart!',
37 'description': 'md5:b04a7e6b3f74e32d7b294cffe8658374',
38 'timestamp': 1589262469,
39 'uploader_id': '6150020952001',
40 'upload_date': '20200512',
42 'add_ie': ['BrightcoveNew'],
44 'url': 'https://zonevideo.telequebec.tv/media/55267/le-soleil/passe-partout',
46 'id': '6167180337001',
49 'description': 'md5:64289c922a8de2abbe99c354daffde02',
50 'uploader_id': '6150020952001',
51 'upload_date': '20200625',
52 'timestamp': 1593090307,
54 'add_ie': ['BrightcoveNew'],
57 'url': 'http://zonevideo.telequebec.tv/media/30261',
58 'only_matching': True,
60 'url': 'https://coucou.telequebec.tv/videos/41788/idee-de-genie/l-heure-du-bain',
61 'only_matching': True,
64 def _real_extract(self
, url
):
65 media_id
= self
._match
_id
(url
)
66 media
= self
._download
_json
(
67 'https://mnmedias.api.telequebec.tv/api/v3/media/' + media_id
,
69 source_id
= next(source_info
['sourceId'] for source_info
in media
['streamInfos'] if source_info
.get('source') == 'Brightcove')
70 info
= self
._brightcove
_result
(source_id
, '22gPKdt7f')
71 product
= media
.get('product') or {}
72 season
= product
.get('season') or {}
74 'description': try_get(media
, lambda x
: x
['descriptions'][-1]['text'], str),
75 'series': try_get(season
, lambda x
: x
['serie']['titre']),
76 'season': season
.get('name'),
77 'season_number': int_or_none(season
.get('seasonNo')),
78 'episode': product
.get('titre'),
79 'episode_number': int_or_none(product
.get('episodeNo')),
84 class TeleQuebecSquatIE(InfoExtractor
):
85 _VALID_URL
= r
'https?://squat\.telequebec\.tv/videos/(?P<id>\d+)'
87 'url': 'https://squat.telequebec.tv/videos/9314',
89 'id': 'd59ae78112d542e793d83cc9d3a5b530',
91 'title': 'Poupeflekta',
92 'description': 'md5:2f0718f8d2f8fece1646ee25fb7bce75',
94 'timestamp': 1569057600,
95 'upload_date': '20190921',
96 'series': 'Miraculous : Les Aventures de Ladybug et Chat Noir',
102 'skip_download': True,
106 def _real_extract(self
, url
):
107 video_id
= self
._match
_id
(url
)
109 video
= self
._download
_json
(
110 f
'https://squat.api.telequebec.tv/v1/videos/{video_id}',
113 media_id
= video
['sourceId']
116 '_type': 'url_transparent',
117 'url': f
'http://zonevideo.telequebec.tv/media/{media_id}',
118 'ie_key': TeleQuebecIE
.ie_key(),
120 'title': video
.get('titre'),
121 'description': video
.get('description'),
122 'timestamp': unified_timestamp(video
.get('datePublication')),
123 'series': video
.get('container'),
124 'season': video
.get('saison'),
125 'season_number': int_or_none(video
.get('noSaison')),
126 'episode_number': int_or_none(video
.get('episode')),
130 class TeleQuebecEmissionIE(InfoExtractor
):
131 _VALID_URL
= r
'''(?x)
134 [^/]+\.telequebec\.tv/emissions/|
135 (?:www\.)?telequebec\.tv/
140 'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente',
142 'id': '6154476028001',
144 'title': 'Des soins esthétiques à 377 % d’intérêts annuels, ça vous tente?',
145 'description': 'md5:cb4d378e073fae6cce1f87c00f84ae9f',
146 'upload_date': '20200505',
147 'timestamp': 1588713424,
148 'uploader_id': '6150020952001',
151 'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression',
152 'only_matching': True,
154 'url': 'http://www.telequebec.tv/masha-et-michka/epi059masha-et-michka-3-053-078',
155 'only_matching': True,
157 'url': 'http://www.telequebec.tv/documentaire/bebes-sur-mesure/',
158 'only_matching': True,
161 def _real_extract(self
, url
):
162 display_id
= self
._match
_id
(url
)
164 webpage
= self
._download
_webpage
(url
, display_id
)
166 media_id
= self
._search
_regex
(
167 r
'mediaId\s*:\s*(?P<id>\d+)', webpage
, 'media id')
169 return self
.url_result(
170 'http://zonevideo.telequebec.tv/media/' + media_id
,
171 TeleQuebecIE
.ie_key())
174 class TeleQuebecLiveIE(TeleQuebecBaseIE
):
175 _VALID_URL
= r
'https?://zonevideo\.telequebec\.tv/(?P<id>endirect)'
177 'url': 'http://zonevideo.telequebec.tv/endirect/',
179 'id': '6159095684001',
181 'title': 're:^Télé-Québec [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
183 'description': 'Canal principal de Télé-Québec',
184 'uploader_id': '6150020952001',
185 'timestamp': 1590439901,
186 'upload_date': '20200525',
189 'skip_download': True,
193 def _real_extract(self
, url
):
194 return self
._brightcove
_result
('6159095684001', 'skCsmi2Uw')
197 class TeleQuebecVideoIE(TeleQuebecBaseIE
):
198 _VALID_URL
= r
'https?://video\.telequebec\.tv/player(?:-live)?/(?P<id>\d+)'
200 'url': 'https://video.telequebec.tv/player/31110/stream',
202 'id': '6202570652001',
204 'title': 'Le coût du véhicule le plus vendu au Canada / Tous les frais liés à la procréation assistée',
205 'description': 'md5:685a7e4c450ba777c60adb6e71e41526',
206 'upload_date': '20201019',
207 'timestamp': 1603115930,
208 'uploader_id': '6101674910001',
211 'url': 'https://video.telequebec.tv/player-live/28527',
212 'only_matching': True,
215 def _call_api(self
, path
, video_id
):
216 return self
._download
_json
(
217 'http://beacon.playback.api.brightcove.com/telequebec/api/assets/' + path
,
218 video_id
, query
={'device_layout': 'web', 'device_type': 'web'})['data']
220 def _real_extract(self
, url
):
221 asset_id
= self
._match
_id
(url
)
222 asset
= self
._call
_api
(asset_id
, asset_id
)['asset']
223 stream
= self
._call
_api
(
224 asset_id
+ '/streams/' + asset
['streams'][0]['id'], asset_id
)['stream']
225 stream_url
= stream
['url']
226 account_id
= try_get(
227 stream
, lambda x
: x
['video_provider_details']['account_id']) or '6101674910001'
228 info
= self
._brightcove
_result
(stream_url
, 'default', account_id
)
230 'description': asset
.get('long_description') or asset
.get('short_description'),
231 'series': asset
.get('series_original_name'),
232 'season_number': int_or_none(asset
.get('season_number')),
233 'episode': asset
.get('original_name'),
234 'episode_number': int_or_none(asset
.get('episode_number')),