]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telequebec.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
14 class TeleQuebecBaseIE(InfoExtractor
):
16 def _limelight_result(media_id
):
18 '_type': 'url_transparent',
20 'limelight:media:' + media_id
, {'geo_countries': ['CA']}),
21 'ie_key': 'LimelightMedia',
25 class TeleQuebecIE(TeleQuebecBaseIE
):
29 zonevideo\.telequebec\.tv/media|
30 coucou\.telequebec\.tv/videos
34 # available till 01.01.2023
35 'url': 'http://zonevideo.telequebec.tv/media/37578/un-petit-choc-et-puis-repart/un-chef-a-la-cabane',
37 'id': '577116881b4b439084e6b1cf4ef8b1b3',
39 'title': 'Un petit choc et puis repart!',
40 'description': 'md5:b04a7e6b3f74e32d7b294cffe8658374',
43 'skip_download': True,
47 'url': 'http://zonevideo.telequebec.tv/media/30261',
48 'only_matching': True,
50 'url': 'https://coucou.telequebec.tv/videos/41788/idee-de-genie/l-heure-du-bain',
51 'only_matching': True,
54 def _real_extract(self
, url
):
55 media_id
= self
._match
_id
(url
)
57 media_data
= self
._download
_json
(
58 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id
,
61 info
= self
._limelight
_result
(media_data
['streamInfo']['sourceId'])
63 'title': media_data
.get('title'),
64 'description': try_get(
65 media_data
, lambda x
: x
['descriptions'][0]['text'], compat_str
),
66 'duration': int_or_none(
67 media_data
.get('durationInMilliseconds'), 1000),
72 class TeleQuebecSquatIE(InfoExtractor
):
73 _VALID_URL
= r
'https://squat\.telequebec\.tv/videos/(?P<id>\d+)'
75 'url': 'https://squat.telequebec.tv/videos/9314',
77 'id': 'd59ae78112d542e793d83cc9d3a5b530',
79 'title': 'Poupeflekta',
80 'description': 'md5:2f0718f8d2f8fece1646ee25fb7bce75',
82 'timestamp': 1569057600,
83 'upload_date': '20190921',
84 'series': 'Miraculous : Les Aventures de Ladybug et Chat Noir',
90 'skip_download': True,
94 def _real_extract(self
, url
):
95 video_id
= self
._match
_id
(url
)
97 video
= self
._download
_json
(
98 'https://squat.api.telequebec.tv/v1/videos/%s' % video_id
,
101 media_id
= video
['sourceId']
104 '_type': 'url_transparent',
105 'url': 'http://zonevideo.telequebec.tv/media/%s' % media_id
,
106 'ie_key': TeleQuebecIE
.ie_key(),
108 'title': video
.get('titre'),
109 'description': video
.get('description'),
110 'timestamp': unified_timestamp(video
.get('datePublication')),
111 'series': video
.get('container'),
112 'season': video
.get('saison'),
113 'season_number': int_or_none(video
.get('noSaison')),
114 'episode_number': int_or_none(video
.get('episode')),
118 class TeleQuebecEmissionIE(TeleQuebecBaseIE
):
119 _VALID_URL
= r
'''(?x)
122 [^/]+\.telequebec\.tv/emissions/|
123 (?:www\.)?telequebec\.tv/
128 'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente',
130 'id': '66648a6aef914fe3badda25e81a4d50a',
132 'title': "Des soins esthétiques à 377 % d'intérêts annuels, ça vous tente?",
133 'description': 'md5:369e0d55d0083f1fc9b71ffb640ea014',
134 'upload_date': '20171024',
135 'timestamp': 1508862118,
138 'skip_download': True,
141 'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression',
142 'only_matching': True,
144 'url': 'http://www.telequebec.tv/masha-et-michka/epi059masha-et-michka-3-053-078',
145 'only_matching': True,
147 'url': 'http://www.telequebec.tv/documentaire/bebes-sur-mesure/',
148 'only_matching': True,
151 def _real_extract(self
, url
):
152 display_id
= self
._match
_id
(url
)
154 webpage
= self
._download
_webpage
(url
, display_id
)
156 media_id
= self
._search
_regex
(
157 r
'mediaUID\s*:\s*["\'][Ll
]imelight_(?P
<id>[a
-z0
-9]{32}
)', webpage,
160 info = self._limelight_result(media_id)
162 'title
': self._og_search_title(webpage, default=None),
163 'description
': self._og_search_description(webpage, default=None),
168 class TeleQuebecLiveIE(InfoExtractor):
169 _VALID_URL = r'https?
://zonevideo\
.telequebec\
.tv
/(?P
<id>endirect
)'
171 'url
': 'http
://zonevideo
.telequebec
.tv
/endirect
/',
175 'title
': 're
:^Télé
-Québec
- En direct
[0-9]{4}
-[0-9]{2}
-[0-9]{2}
[0-9]{2}
:[0-9]{2}$
',
179 'skip_download
': True,
183 def _real_extract(self, url):
184 video_id = self._match_id(url)
187 webpage = self._download_webpage(
188 'https
://player
.telequebec
.tv
/Tq_VideoPlayer
.js
', video_id,
191 m3u8_url = self._search_regex(
192 r'm3U8Url\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
193 'm3u8 url', default=None, group='url')
195 m3u8_url = 'https://teleqmmd.mmdlive.lldns.net/teleqmmd/f386e3b206814e1f8c8c1c71c0f8e748/manifest.m3u8'
196 formats = self._extract_m3u8_formats(
197 m3u8_url, video_id, 'mp4', m3u8_id='hls')
198 self._sort_formats(formats)
202 'title': self._live_title('Télé-Québec - En direct'),