1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class TeleQuebecBaseIE(InfoExtractor
):
12 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
15 def _brightcove_result(brightcove_id
, player_id
, account_id
='6150020952001'):
17 '_type': 'url_transparent',
18 'url': smuggle_url(TeleQuebecBaseIE
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, brightcove_id
), {'geo_countries': ['CA']}
),
19 'ie_key': 'BrightcoveNew',
23 class TeleQuebecIE(TeleQuebecBaseIE
):
27 zonevideo\.telequebec\.tv/media|
28 coucou\.telequebec\.tv/videos
32 # available till 01.01.2023
33 'url': 'http://zonevideo.telequebec.tv/media/37578/un-petit-choc-et-puis-repart/un-chef-a-la-cabane',
35 'id': '6155972771001',
37 'title': 'Un petit choc et puis repart!',
38 'description': 'md5:b04a7e6b3f74e32d7b294cffe8658374',
39 'timestamp': 1589262469,
40 'uploader_id': '6150020952001',
41 'upload_date': '20200512',
43 'add_ie': ['BrightcoveNew'],
45 'url': 'https://zonevideo.telequebec.tv/media/55267/le-soleil/passe-partout',
47 'id': '6167180337001',
50 'description': 'md5:64289c922a8de2abbe99c354daffde02',
51 'uploader_id': '6150020952001',
52 'upload_date': '20200625',
53 'timestamp': 1593090307,
55 'add_ie': ['BrightcoveNew'],
58 'url': 'http://zonevideo.telequebec.tv/media/30261',
59 'only_matching': True,
61 'url': 'https://coucou.telequebec.tv/videos/41788/idee-de-genie/l-heure-du-bain',
62 'only_matching': True,
65 def _real_extract(self
, url
):
66 media_id
= self
._match
_id
(url
)
67 media
= self
._download
_json
(
68 'https://mnmedias.api.telequebec.tv/api/v3/media/' + media_id
,
70 source_id
= next(source_info
['sourceId'] for source_info
in media
['streamInfos'] if source_info
.get('source') == 'Brightcove')
71 info
= self
._brightcove
_result
(source_id
, '22gPKdt7f')
72 product
= media
.get('product') or {}
73 season
= product
.get('season') or {}
75 'description': try_get(media
, lambda x
: x
['descriptions'][-1]['text'], compat_str
),
76 'series': try_get(season
, lambda x
: x
['serie']['titre']),
77 'season': season
.get('name'),
78 'season_number': int_or_none(season
.get('seasonNo')),
79 'episode': product
.get('titre'),
80 'episode_number': int_or_none(product
.get('episodeNo')),
85 class TeleQuebecSquatIE(InfoExtractor
):
86 _VALID_URL
= r
'https://squat\.telequebec\.tv/videos/(?P<id>\d+)'
88 'url': 'https://squat.telequebec.tv/videos/9314',
90 'id': 'd59ae78112d542e793d83cc9d3a5b530',
92 'title': 'Poupeflekta',
93 'description': 'md5:2f0718f8d2f8fece1646ee25fb7bce75',
95 'timestamp': 1569057600,
96 'upload_date': '20190921',
97 'series': 'Miraculous : Les Aventures de Ladybug et Chat Noir',
100 'episode_number': 57,
103 'skip_download': True,
107 def _real_extract(self
, url
):
108 video_id
= self
._match
_id
(url
)
110 video
= self
._download
_json
(
111 'https://squat.api.telequebec.tv/v1/videos/%s' % video_id
,
114 media_id
= video
['sourceId']
117 '_type': 'url_transparent',
118 'url': 'http://zonevideo.telequebec.tv/media/%s' % media_id
,
119 'ie_key': TeleQuebecIE
.ie_key(),
121 'title': video
.get('titre'),
122 'description': video
.get('description'),
123 'timestamp': unified_timestamp(video
.get('datePublication')),
124 'series': video
.get('container'),
125 'season': video
.get('saison'),
126 'season_number': int_or_none(video
.get('noSaison')),
127 'episode_number': int_or_none(video
.get('episode')),
131 class TeleQuebecEmissionIE(InfoExtractor
):
132 _VALID_URL
= r
'''(?x)
135 [^/]+\.telequebec\.tv/emissions/|
136 (?:www\.)?telequebec\.tv/
141 'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente',
143 'id': '6154476028001',
145 'title': 'Des soins esthétiques à 377 % d’intérêts annuels, ça vous tente?',
146 'description': 'md5:cb4d378e073fae6cce1f87c00f84ae9f',
147 'upload_date': '20200505',
148 'timestamp': 1588713424,
149 'uploader_id': '6150020952001',
152 'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression',
153 'only_matching': True,
155 'url': 'http://www.telequebec.tv/masha-et-michka/epi059masha-et-michka-3-053-078',
156 'only_matching': True,
158 'url': 'http://www.telequebec.tv/documentaire/bebes-sur-mesure/',
159 'only_matching': True,
162 def _real_extract(self
, url
):
163 display_id
= self
._match
_id
(url
)
165 webpage
= self
._download
_webpage
(url
, display_id
)
167 media_id
= self
._search
_regex
(
168 r
'mediaId\s*:\s*(?P<id>\d+)', webpage
, 'media id')
170 return self
.url_result(
171 'http://zonevideo.telequebec.tv/media/' + media_id
,
172 TeleQuebecIE
.ie_key())
175 class TeleQuebecLiveIE(TeleQuebecBaseIE
):
176 _VALID_URL
= r
'https?://zonevideo\.telequebec\.tv/(?P<id>endirect)'
178 'url': 'http://zonevideo.telequebec.tv/endirect/',
180 'id': '6159095684001',
182 'title': 're:^Télé-Québec [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
184 'description': 'Canal principal de Télé-Québec',
185 'uploader_id': '6150020952001',
186 'timestamp': 1590439901,
187 'upload_date': '20200525',
190 'skip_download': True,
194 def _real_extract(self
, url
):
195 return self
._brightcove
_result
('6159095684001', 'skCsmi2Uw')
198 class TeleQuebecVideoIE(TeleQuebecBaseIE
):
199 _VALID_URL
= r
'https?://video\.telequebec\.tv/player(?:-live)?/(?P<id>\d+)'
201 'url': 'https://video.telequebec.tv/player/31110/stream',
203 'id': '6202570652001',
205 'title': 'Le coût du véhicule le plus vendu au Canada / Tous les frais liés à la procréation assistée',
206 'description': 'md5:685a7e4c450ba777c60adb6e71e41526',
207 'upload_date': '20201019',
208 'timestamp': 1603115930,
209 'uploader_id': '6101674910001',
212 'url': 'https://video.telequebec.tv/player-live/28527',
213 'only_matching': True,
216 def _call_api(self
, path
, video_id
):
217 return self
._download
_json
(
218 'http://beacon.playback.api.brightcove.com/telequebec/api/assets/' + path
,
219 video_id
, query
={'device_layout': 'web', 'device_type': 'web'}
)['data']
221 def _real_extract(self
, url
):
222 asset_id
= self
._match
_id
(url
)
223 asset
= self
._call
_api
(asset_id
, asset_id
)['asset']
224 stream
= self
._call
_api
(
225 asset_id
+ '/streams/' + asset
['streams'][0]['id'], asset_id
)['stream']
226 stream_url
= stream
['url']
227 account_id
= try_get(
228 stream
, lambda x
: x
['video_provider_details']['account_id']) or '6101674910001'
229 info
= self
._brightcove
_result
(stream_url
, 'default', account_id
)
231 'description': asset
.get('long_description') or asset
.get('short_description'),
232 'series': asset
.get('series_original_name'),
233 'season_number': int_or_none(asset
.get('season_number')),
234 'episode': asset
.get('original_name'),
235 'episode_number': int_or_none(asset
.get('episode_number')),