]>
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',
41 'upload_date': '20180222',
42 'timestamp': 1519326631,
45 'skip_download': True,
49 'url': 'http://zonevideo.telequebec.tv/media/30261',
50 'only_matching': True,
52 'url': 'https://coucou.telequebec.tv/videos/41788/idee-de-genie/l-heure-du-bain',
53 'only_matching': True,
56 def _real_extract(self
, url
):
57 media_id
= self
._match
_id
(url
)
59 media_data
= self
._download
_json
(
60 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id
,
63 info
= self
._limelight
_result
(media_data
['streamInfo']['sourceId'])
65 'title': media_data
.get('title'),
66 'description': try_get(
67 media_data
, lambda x
: x
['descriptions'][0]['text'], compat_str
),
68 'duration': int_or_none(
69 media_data
.get('durationInMilliseconds'), 1000),
74 class TeleQuebecSquatIE(InfoExtractor
):
75 _VALID_URL
= r
'https://squat\.telequebec\.tv/videos/(?P<id>\d+)'
77 'url': 'https://squat.telequebec.tv/videos/9314',
79 'id': 'd59ae78112d542e793d83cc9d3a5b530',
81 'title': 'Poupeflekta',
82 'description': 'md5:2f0718f8d2f8fece1646ee25fb7bce75',
84 'timestamp': 1569057600,
85 'upload_date': '20190921',
86 'series': 'Miraculous : Les Aventures de Ladybug et Chat Noir',
92 'skip_download': True,
96 def _real_extract(self
, url
):
97 video_id
= self
._match
_id
(url
)
99 video
= self
._download
_json
(
100 'https://squat.api.telequebec.tv/v1/videos/%s' % video_id
,
103 media_id
= video
['sourceId']
106 '_type': 'url_transparent',
107 'url': 'http://zonevideo.telequebec.tv/media/%s' % media_id
,
108 'ie_key': TeleQuebecIE
.ie_key(),
110 'title': video
.get('titre'),
111 'description': video
.get('description'),
112 'timestamp': unified_timestamp(video
.get('datePublication')),
113 'series': video
.get('container'),
114 'season': video
.get('saison'),
115 'season_number': int_or_none(video
.get('noSaison')),
116 'episode_number': int_or_none(video
.get('episode')),
120 class TeleQuebecEmissionIE(TeleQuebecBaseIE
):
121 _VALID_URL
= r
'''(?x)
124 [^/]+\.telequebec\.tv/emissions/|
125 (?:www\.)?telequebec\.tv/
130 'url': 'http://lindicemcsween.telequebec.tv/emissions/100430013/des-soins-esthetiques-a-377-d-interets-annuels-ca-vous-tente',
132 'id': '66648a6aef914fe3badda25e81a4d50a',
134 'title': "Des soins esthétiques à 377 % d'intérêts annuels, ça vous tente?",
135 'description': 'md5:369e0d55d0083f1fc9b71ffb640ea014',
136 'upload_date': '20171024',
137 'timestamp': 1508862118,
140 'skip_download': True,
143 'url': 'http://bancpublic.telequebec.tv/emissions/emission-49/31986/jeunes-meres-sous-pression',
144 'only_matching': True,
146 'url': 'http://www.telequebec.tv/masha-et-michka/epi059masha-et-michka-3-053-078',
147 'only_matching': True,
149 'url': 'http://www.telequebec.tv/documentaire/bebes-sur-mesure/',
150 'only_matching': True,
153 def _real_extract(self
, url
):
154 display_id
= self
._match
_id
(url
)
156 webpage
= self
._download
_webpage
(url
, display_id
)
158 media_id
= self
._search
_regex
(
159 r
'mediaUID\s*:\s*["\'][Ll
]imelight_(?P
<id>[a
-z0
-9]{32}
)', webpage,
162 info = self._limelight_result(media_id)
164 'title
': self._og_search_title(webpage, default=None),
165 'description
': self._og_search_description(webpage, default=None),
170 class TeleQuebecLiveIE(InfoExtractor):
171 _VALID_URL = r'https?
://zonevideo\
.telequebec\
.tv
/(?P
<id>endirect
)'
173 'url
': 'http
://zonevideo
.telequebec
.tv
/endirect
/',
177 'title
': 're
:^Télé
-Québec
- En direct
[0-9]{4}
-[0-9]{2}
-[0-9]{2}
[0-9]{2}
:[0-9]{2}$
',
181 'skip_download
': True,
185 def _real_extract(self, url):
186 video_id = self._match_id(url)
189 webpage = self._download_webpage(
190 'https
://player
.telequebec
.tv
/Tq_VideoPlayer
.js
', video_id,
193 m3u8_url = self._search_regex(
194 r'm3U8Url\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
195 'm3u8 url', default=None, group='url')
197 m3u8_url = 'https://teleqmmd.mmdlive.lldns.net/teleqmmd/f386e3b206814e1f8c8c1c71c0f8e748/manifest.m3u8'
198 formats = self._extract_m3u8_formats(
199 m3u8_url, video_id, 'mp4', m3u8_id='hls')
200 self._sort_formats(formats)
204 'title': self._live_title('Télé-Québec - En direct'),