]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/nbc.py
[youtube] Force `hl=en` for comments (#594)
[yt-dlp.git] / yt_dlp / extractor / nbc.py
CommitLineData
cd7ee7aa
JMF
1from __future__ import unicode_literals
2
58284890 3import base64
1139935d
RA
4import json
5import re
0bc56fa6
JMF
6
7from .common import InfoExtractor
574b2a73 8from .theplatform import ThePlatformIE
fdf9b959 9from .adobepass import AdobePassIE
d0c5fabc 10from ..compat import compat_urllib_parse_unquote
1cc79574 11from ..utils import (
895e5c03 12 int_or_none,
9160a0c6 13 parse_age_limit,
895e5c03 14 parse_duration,
b46b65ed 15 smuggle_url,
895e5c03
RA
16 try_get,
17 unified_timestamp,
6e416b21 18 update_url_query,
37e64add 19)
0bc56fa6
JMF
20
21
9160a0c6 22class NBCIE(ThePlatformIE):
d673ab65 23 _VALID_URL = r'https?(?P<permalink>://(?:www\.)?nbc\.com/(?:classic-tv/)?[^/]+/video/[^/]+/(?P<id>n?\d+))'
58c1f6f0
S
24
25 _TESTS = [
26 {
fdf9b959 27 'url': 'http://www.nbc.com/the-tonight-show/video/jimmy-fallon-surprises-fans-at-ben-jerrys/2848237',
58c1f6f0 28 'info_dict': {
fdf9b959 29 'id': '2848237',
e881c4bc 30 'ext': 'mp4',
5c8a3f86
JMF
31 'title': 'Jimmy Fallon Surprises Fans at Ben & Jerry\'s',
32 'description': 'Jimmy gives out free scoops of his new "Tonight Dough" ice cream flavor by surprising customers at the Ben & Jerry\'s scoop shop.',
79ba9140 33 'timestamp': 1424246400,
34 'upload_date': '20150218',
35 'uploader': 'NBCU-COM',
58c1f6f0 36 },
e881c4bc
YCH
37 'params': {
38 # m3u8 download
39 'skip_download': True,
40 },
020cf5eb 41 },
b9b3ab45
YCH
42 {
43 'url': 'http://www.nbc.com/saturday-night-live/video/star-wars-teaser/2832821',
44 'info_dict': {
e881c4bc
YCH
45 'id': '2832821',
46 'ext': 'mp4',
b9b3ab45
YCH
47 'title': 'Star Wars Teaser',
48 'description': 'md5:0b40f9cbde5b671a7ff62fceccc4f442',
79ba9140 49 'timestamp': 1417852800,
50 'upload_date': '20141206',
51 'uploader': 'NBCU-COM',
b9b3ab45 52 },
e881c4bc
YCH
53 'params': {
54 # m3u8 download
55 'skip_download': True,
56 },
b9b3ab45 57 'skip': 'Only works from US',
0fe2ff78 58 },
e6e90515
YCH
59 {
60 # HLS streams requires the 'hdnea3' cookie
61 'url': 'http://www.nbc.com/Kings/video/goliath/n1806',
62 'info_dict': {
fdf9b959 63 'id': '101528f5a9e8127b107e98c5e6ce4638',
e6e90515
YCH
64 'ext': 'mp4',
65 'title': 'Goliath',
66 'description': 'When an unknown soldier saves the life of the King\'s son in battle, he\'s thrust into the limelight and politics of the kingdom.',
67 'timestamp': 1237100400,
68 'upload_date': '20090315',
69 'uploader': 'NBCU-COM',
70 },
71 'params': {
72 'skip_download': True,
73 },
74 'skip': 'Only works from US',
d673ab65
L
75 },
76 {
77 'url': 'https://www.nbc.com/classic-tv/charles-in-charge/video/charles-in-charge-pilot/n3310',
78 'only_matching': True,
79 },
d0c5fabc
T
80 {
81 # Percent escaped url
82 'url': 'https://www.nbc.com/up-all-night/video/day-after-valentine%27s-day/n2189',
83 'only_matching': True,
84 }
58c1f6f0 85 ]
020cf5eb
JMF
86
87 def _real_extract(self, url):
52294cdd 88 permalink, video_id = re.match(self._VALID_URL, url).groups()
d0c5fabc 89 permalink = 'http' + compat_urllib_parse_unquote(permalink)
48ff5590 90 video_data = self._download_json(
311ee457 91 'https://friendship.nbc.co/v2/graphql', video_id, query={
48ff5590
RA
92 'query': '''query bonanzaPage(
93 $app: NBCUBrands! = nbc
94 $name: String!
95 $oneApp: Boolean
96 $platform: SupportedPlatforms! = web
97 $type: EntityPageType! = VIDEO
98 $userId: String!
99) {
100 bonanzaPage(
101 app: $app
102 name: $name
103 oneApp: $oneApp
104 platform: $platform
105 type: $type
106 userId: $userId
107 ) {
108 metadata {
311ee457
RA
109 ... on VideoPageData {
110 description
111 episodeNumber
112 keywords
113 locked
114 mpxAccountId
115 mpxGuid
116 rating
48ff5590 117 resourceId
311ee457
RA
118 seasonNumber
119 secondaryTitle
120 seriesShortTitle
121 }
122 }
123 }
48ff5590
RA
124}''',
125 'variables': json.dumps({
126 'name': permalink,
127 'oneApp': True,
128 'userId': '0',
129 }),
130 })['data']['bonanzaPage']['metadata']
2eeb588e
RA
131 query = {
132 'mbr': 'true',
133 'manifest': 'm3u',
134 }
311ee457 135 video_id = video_data['mpxGuid']
9160a0c6
TSJ
136 tp_path = 'NnzsPC/media/guid/%s/%s' % (video_data.get('mpxAccountId') or '2410887629', video_id)
137 tpm = self._download_theplatform_metadata(tp_path, video_id)
138 title = tpm.get('title') or video_data.get('secondaryTitle')
311ee457 139 if video_data.get('locked'):
2eeb588e 140 resource = self._get_mvpd_resource(
48ff5590
RA
141 video_data.get('resourceId') or 'nbcentertainment',
142 title, video_id, video_data.get('rating'))
2eeb588e
RA
143 query['auth'] = self._extract_mvpd_auth(
144 url, video_id, 'nbcentertainment', resource)
145 theplatform_url = smuggle_url(update_url_query(
311ee457 146 'http://link.theplatform.com/s/NnzsPC/media/guid/%s/%s' % (video_data.get('mpxAccountId') or '2410887629', video_id),
2eeb588e 147 query), {'force_smil_url': True})
9160a0c6
TSJ
148
149 # Empty string or 0 can be valid values for these. So the check must be `is None`
150 description = video_data.get('description')
151 if description is None:
152 description = tpm.get('description')
153 episode_number = int_or_none(video_data.get('episodeNumber'))
154 if episode_number is None:
155 episode_number = int_or_none(tpm.get('nbcu$airOrder'))
156 rating = video_data.get('rating')
157 if rating is None:
158 try_get(tpm, lambda x: x['ratings'][0]['rating'])
159 season_number = int_or_none(video_data.get('seasonNumber'))
160 if season_number is None:
161 season_number = int_or_none(tpm.get('nbcu$seasonNumber'))
162 series = video_data.get('seriesShortTitle')
163 if series is None:
164 series = tpm.get('nbcu$seriesShortTitle')
165 tags = video_data.get('keywords')
166 if tags is None or len(tags) == 0:
167 tags = tpm.get('keywords')
168
2eeb588e 169 return {
e881c4bc 170 '_type': 'url_transparent',
9160a0c6
TSJ
171 'age_limit': parse_age_limit(rating),
172 'description': description,
173 'episode': title,
174 'episode_number': episode_number,
e881c4bc 175 'id': video_id,
9160a0c6
TSJ
176 'ie_key': 'ThePlatform',
177 'season_number': season_number,
178 'series': series,
179 'tags': tags,
2eeb588e
RA
180 'title': title,
181 'url': theplatform_url,
e881c4bc 182 }
020cf5eb
JMF
183
184
a2a4d5fa 185class NBCSportsVPlayerIE(InfoExtractor):
29f7c58a 186 _VALID_URL_BASE = r'https?://(?:vplayer\.nbcsports\.com|(?:www\.)?nbcsports\.com/vplayer)/'
187 _VALID_URL = _VALID_URL_BASE + r'(?:[^/]+/)+(?P<id>[0-9a-zA-Z_]+)'
a28ccbab 188
5cbb2699 189 _TESTS = [{
12ea5c79 190 'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_embed/select/9CsDKds0kvHI',
a28ccbab
YCH
191 'info_dict': {
192 'id': '9CsDKds0kvHI',
12ea5c79 193 'ext': 'mp4',
a28ccbab
YCH
194 'description': 'md5:df390f70a9ba7c95ff1daace988f0d8d',
195 'title': 'Tyler Kalinoski hits buzzer-beater to lift Davidson',
79ba9140 196 'timestamp': 1426270238,
197 'upload_date': '20150313',
198 'uploader': 'NBCU-SPORTS',
a28ccbab 199 }
5cbb2699 200 }, {
12ea5c79 201 'url': 'https://vplayer.nbcsports.com/p/BxmELC/nbcsports_embed/select/media/_hqLjQ95yx8Z',
5cbb2699 202 'only_matching': True,
29f7c58a 203 }, {
204 'url': 'https://www.nbcsports.com/vplayer/p/BxmELC/nbcsports/select/PHJSaFWbrTY9?form=html&autoPlay=true',
205 'only_matching': True,
5cbb2699 206 }]
a28ccbab 207
a2a4d5fa
YCH
208 @staticmethod
209 def _extract_url(webpage):
210 iframe_m = re.search(
29f7c58a 211 r'<(?:iframe[^>]+|div[^>]+data-(?:mpx-)?)src="(?P<url>%s[^"]+)"' % NBCSportsVPlayerIE._VALID_URL_BASE, webpage)
a2a4d5fa
YCH
212 if iframe_m:
213 return iframe_m.group('url')
214
a28ccbab
YCH
215 def _real_extract(self, url):
216 video_id = self._match_id(url)
217 webpage = self._download_webpage(url, video_id)
12ea5c79
PV
218 theplatform_url = self._og_search_video_url(webpage).replace(
219 'vplayer.nbcsports.com', 'player.theplatform.com')
a28ccbab
YCH
220 return self.url_result(theplatform_url, 'ThePlatform')
221
222
a2a4d5fa 223class NBCSportsIE(InfoExtractor):
29f7c58a 224 _VALID_URL = r'https?://(?:www\.)?nbcsports\.com//?(?!vplayer/)(?:[^/]+/)+(?P<id>[0-9a-z-]+)'
a2a4d5fa 225
29f7c58a 226 _TESTS = [{
227 # iframe src
a2a4d5fa 228 'url': 'http://www.nbcsports.com//college-basketball/ncaab/tom-izzo-michigan-st-has-so-much-respect-duke',
a2a4d5fa
YCH
229 'info_dict': {
230 'id': 'PHJSaFWbrTY9',
29f7c58a 231 'ext': 'mp4',
a2a4d5fa
YCH
232 'title': 'Tom Izzo, Michigan St. has \'so much respect\' for Duke',
233 'description': 'md5:ecb459c9d59e0766ac9c7d5d0eda8113',
0738187f
YCH
234 'uploader': 'NBCU-SPORTS',
235 'upload_date': '20150330',
236 'timestamp': 1427726529,
a2a4d5fa 237 }
29f7c58a 238 }, {
239 # data-mpx-src
240 'url': 'https://www.nbcsports.com/philadelphia/philadelphia-phillies/bruce-bochy-hector-neris-hes-idiot',
241 'only_matching': True,
242 }, {
243 # data-src
244 'url': 'https://www.nbcsports.com/boston/video/report-card-pats-secondary-no-match-josh-allen',
245 'only_matching': True,
246 }]
a2a4d5fa
YCH
247
248 def _real_extract(self, url):
249 video_id = self._match_id(url)
250 webpage = self._download_webpage(url, video_id)
251 return self.url_result(
252 NBCSportsVPlayerIE._extract_url(webpage), 'NBCSportsVPlayer')
253
254
1139935d
RA
255class NBCSportsStreamIE(AdobePassIE):
256 _VALID_URL = r'https?://stream\.nbcsports\.com/.+?\bpid=(?P<id>\d+)'
257 _TEST = {
258 'url': 'http://stream.nbcsports.com/nbcsn/generic?pid=206559',
259 'info_dict': {
260 'id': '206559',
261 'ext': 'mp4',
262 'title': 'Amgen Tour of California Women\'s Recap',
263 'description': 'md5:66520066b3b5281ada7698d0ea2aa894',
264 },
265 'params': {
266 # m3u8 download
267 'skip_download': True,
268 },
269 'skip': 'Requires Adobe Pass Authentication',
270 }
271
272 def _real_extract(self, url):
273 video_id = self._match_id(url)
274 live_source = self._download_json(
275 'http://stream.nbcsports.com/data/live_sources_%s.json' % video_id,
276 video_id)
277 video_source = live_source['videoSources'][0]
278 title = video_source['title']
279 source_url = None
280 for k in ('source', 'msl4source', 'iossource', 'hlsv4'):
281 sk = k + 'Url'
282 source_url = video_source.get(sk) or video_source.get(sk + 'Alt')
283 if source_url:
284 break
285 else:
286 source_url = video_source['ottStreamUrl']
287 is_live = video_source.get('type') == 'live' or video_source.get('status') == 'Live'
288 resource = self._get_mvpd_resource('nbcsports', title, video_id, '')
289 token = self._extract_mvpd_auth(url, video_id, 'nbcsports', resource)
290 tokenized_url = self._download_json(
291 'https://token.playmakerservices.com/cdn',
292 video_id, data=json.dumps({
293 'requestorId': 'nbcsports',
294 'pid': video_id,
295 'application': 'NBCSports',
296 'version': 'v1',
297 'platform': 'desktop',
298 'cdn': 'akamai',
299 'url': video_source['sourceUrl'],
300 'token': base64.b64encode(token.encode()).decode(),
301 'resourceId': base64.b64encode(resource.encode()).decode(),
302 }).encode())['tokenizedUrl']
303 formats = self._extract_m3u8_formats(tokenized_url, video_id, 'mp4')
304 self._sort_formats(formats)
305 return {
306 'id': video_id,
307 'title': self._live_title(title) if is_live else title,
308 'description': live_source.get('description'),
309 'formats': formats,
310 'is_live': is_live,
311 }
312
313
574b2a73 314class NBCNewsIE(ThePlatformIE):
a843464a 315 _VALID_URL = r'(?x)https?://(?:www\.)?(?:nbcnews|today|msnbc)\.com/([^/]+/)*(?:.*-)?(?P<id>[^/?]+)'
0bc56fa6 316
87fe568c 317 _TESTS = [
87fe568c 318 {
574b2a73 319 'url': 'http://www.nbcnews.com/watch/nbcnews-com/how-twitter-reacted-to-the-snowden-interview-269389891880',
895e5c03 320 'md5': 'cf4bc9e6ce0130f00f545d80ecedd4bf',
87fe568c 321 'info_dict': {
a843464a 322 'id': '269389891880',
10e3d734 323 'ext': 'mp4',
87fe568c
JMF
324 'title': 'How Twitter Reacted To The Snowden Interview',
325 'description': 'md5:65a0bd5d76fe114f3c2727aa3a81fe64',
0437307a
RA
326 'timestamp': 1401363060,
327 'upload_date': '20140529',
87fe568c 328 },
87fe568c 329 },
2df54b4b
S
330 {
331 'url': 'http://www.nbcnews.com/feature/dateline-full-episodes/full-episode-family-business-n285156',
332 'md5': 'fdbf39ab73a72df5896b6234ff98518a',
333 'info_dict': {
0437307a 334 'id': '529953347624',
2df54b4b
S
335 'ext': 'mp4',
336 'title': 'FULL EPISODE: Family Business',
337 'description': 'md5:757988edbaae9d7be1d585eb5d55cc04',
338 },
574b2a73 339 'skip': 'This page is unavailable.',
2df54b4b 340 },
d9aa2b78
RS
341 {
342 'url': 'http://www.nbcnews.com/nightly-news/video/nightly-news-with-brian-williams-full-broadcast-february-4-394064451844',
895e5c03 343 'md5': '8eb831eca25bfa7d25ddd83e85946548',
d9aa2b78 344 'info_dict': {
a843464a 345 'id': '394064451844',
d9aa2b78
RS
346 'ext': 'mp4',
347 'title': 'Nightly News with Brian Williams Full Broadcast (February 4)',
348 'description': 'md5:1c10c1eccbe84a26e5debb4381e2d3c5',
0437307a 349 'timestamp': 1423104900,
0437307a 350 'upload_date': '20150205',
d9aa2b78
RS
351 },
352 },
574b2a73 353 {
354 'url': 'http://www.nbcnews.com/business/autos/volkswagen-11-million-vehicles-could-have-suspect-software-emissions-scandal-n431456',
895e5c03 355 'md5': '4a8c4cec9e1ded51060bdda36ff0a5c0',
574b2a73 356 'info_dict': {
895e5c03 357 'id': 'n431456',
574b2a73 358 'ext': 'mp4',
895e5c03
RA
359 'title': "Volkswagen U.S. Chief: We 'Totally Screwed Up'",
360 'description': 'md5:d22d1281a24f22ea0880741bb4dd6301',
0437307a
RA
361 'upload_date': '20150922',
362 'timestamp': 1442917800,
574b2a73 363 },
574b2a73 364 },
cb7d4d0e 365 {
366 'url': 'http://www.today.com/video/see-the-aurora-borealis-from-space-in-stunning-new-nasa-video-669831235788',
367 'md5': '118d7ca3f0bea6534f119c68ef539f71',
368 'info_dict': {
a843464a 369 'id': '669831235788',
cb7d4d0e 370 'ext': 'mp4',
371 'title': 'See the aurora borealis from space in stunning new NASA video',
372 'description': 'md5:74752b7358afb99939c5f8bb2d1d04b1',
373 'upload_date': '20160420',
374 'timestamp': 1461152093,
0437307a
RA
375 },
376 },
377 {
378 'url': 'http://www.msnbc.com/all-in-with-chris-hayes/watch/the-chaotic-gop-immigration-vote-314487875924',
379 'md5': '6d236bf4f3dddc226633ce6e2c3f814d',
380 'info_dict': {
a843464a 381 'id': '314487875924',
0437307a
RA
382 'ext': 'mp4',
383 'title': 'The chaotic GOP immigration vote',
384 'description': 'The Republican House votes on a border bill that has no chance of getting through the Senate or signed by the President and is drawing criticism from all sides.',
ec85ded8 385 'thumbnail': r're:^https?://.*\.jpg$',
0437307a
RA
386 'timestamp': 1406937606,
387 'upload_date': '20140802',
cb7d4d0e 388 },
389 },
3f125c8c
S
390 {
391 'url': 'http://www.nbcnews.com/watch/dateline/full-episode--deadly-betrayal-386250819952',
392 'only_matching': True,
393 },
5de008e8
YCH
394 {
395 # From http://www.vulture.com/2016/06/letterman-couldnt-care-less-about-late-night.html
396 'url': 'http://www.nbcnews.com/widget/video-embed/701714499682',
397 'only_matching': True,
398 },
87fe568c 399 ]
0bc56fa6
JMF
400
401 def _real_extract(self, url):
a843464a 402 video_id = self._match_id(url)
895e5c03
RA
403 webpage = self._download_webpage(url, video_id)
404
405 data = self._parse_json(self._search_regex(
8bdd16b4 406 r'<script[^>]+id="__NEXT_DATA__"[^>]*>({.+?})</script>',
407 webpage, 'bootstrap json'), video_id)['props']['initialState']
895e5c03
RA
408 video_data = try_get(data, lambda x: x['video']['current'], dict)
409 if not video_data:
410 video_data = data['article']['content'][0]['primaryMedia']['video']
411 title = video_data['headline']['primary']
412
413 formats = []
414 for va in video_data.get('videoAssets', []):
415 public_url = va.get('publicUrl')
416 if not public_url:
417 continue
418 if '://link.theplatform.com/' in public_url:
419 public_url = update_url_query(public_url, {'format': 'redirect'})
420 format_id = va.get('format')
421 if format_id == 'M3U':
422 formats.extend(self._extract_m3u8_formats(
423 public_url, video_id, 'mp4', 'm3u8_native',
424 m3u8_id=format_id, fatal=False))
425 continue
426 tbr = int_or_none(va.get('bitrate'), 1000)
427 if tbr:
428 format_id += '-%d' % tbr
429 formats.append({
430 'format_id': format_id,
431 'url': public_url,
432 'width': int_or_none(va.get('width')),
433 'height': int_or_none(va.get('height')),
434 'tbr': tbr,
435 'ext': 'mp4',
436 })
437 self._sort_formats(formats)
6e416b21 438
895e5c03
RA
439 subtitles = {}
440 closed_captioning = video_data.get('closedCaptioning')
441 if closed_captioning:
442 for cc_url in closed_captioning.values():
443 if not cc_url:
444 continue
445 subtitles.setdefault('en', []).append({
446 'url': cc_url,
447 })
6e416b21 448
a843464a 449 return {
a843464a 450 'id': video_id,
895e5c03
RA
451 'title': title,
452 'description': try_get(video_data, lambda x: x['description']['primary']),
453 'thumbnail': try_get(video_data, lambda x: x['primaryImage']['url']['primary']),
454 'duration': parse_duration(video_data.get('duration')),
455 'timestamp': unified_timestamp(video_data.get('datePublished')),
456 'formats': formats,
457 'subtitles': subtitles,
a843464a 458 }
be457302
YCH
459
460
461class NBCOlympicsIE(InfoExtractor):
58284890 462 IE_NAME = 'nbcolympics'
be457302
YCH
463 _VALID_URL = r'https?://www\.nbcolympics\.com/video/(?P<id>[a-z-]+)'
464
465 _TEST = {
466 # Geo-restricted to US
467 'url': 'http://www.nbcolympics.com/video/justin-roses-son-leo-was-tears-after-his-dad-won-gold',
468 'md5': '54fecf846d05429fbaa18af557ee523a',
469 'info_dict': {
470 'id': 'WjTBzDXx5AUq',
471 'display_id': 'justin-roses-son-leo-was-tears-after-his-dad-won-gold',
472 'ext': 'mp4',
473 'title': 'Rose\'s son Leo was in tears after his dad won gold',
474 'description': 'Olympic gold medalist Justin Rose gets emotional talking to the impact his win in men\'s golf has already had on his children.',
475 'timestamp': 1471274964,
476 'upload_date': '20160815',
477 'uploader': 'NBCU-SPORTS',
478 },
479 }
480
481 def _real_extract(self, url):
482 display_id = self._match_id(url)
483
484 webpage = self._download_webpage(url, display_id)
485
486 drupal_settings = self._parse_json(self._search_regex(
487 r'jQuery\.extend\(Drupal\.settings\s*,\s*({.+?})\);',
488 webpage, 'drupal settings'), display_id)
489
490 iframe_url = drupal_settings['vod']['iframe_url']
491 theplatform_url = iframe_url.replace(
492 'vplayer.nbcolympics.com', 'player.theplatform.com')
493
494 return {
495 '_type': 'url_transparent',
496 'url': theplatform_url,
497 'ie_key': ThePlatformIE.ie_key(),
498 'display_id': display_id,
499 }
58284890
RA
500
501
502class NBCOlympicsStreamIE(AdobePassIE):
503 IE_NAME = 'nbcolympics:stream'
504 _VALID_URL = r'https?://stream\.nbcolympics\.com/(?P<id>[0-9a-z-]+)'
505 _TEST = {
506 'url': 'http://stream.nbcolympics.com/2018-winter-olympics-nbcsn-evening-feb-8',
507 'info_dict': {
508 'id': '203493',
509 'ext': 'mp4',
510 'title': 're:Curling, Alpine, Luge [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
511 },
512 'params': {
513 # m3u8 download
514 'skip_download': True,
515 },
516 }
517 _DATA_URL_TEMPLATE = 'http://stream.nbcolympics.com/data/%s_%s.json'
518
519 def _real_extract(self, url):
520 display_id = self._match_id(url)
521 webpage = self._download_webpage(url, display_id)
522 pid = self._search_regex(r'pid\s*=\s*(\d+);', webpage, 'pid')
523 resource = self._search_regex(
524 r"resource\s*=\s*'(.+)';", webpage,
525 'resource').replace("' + pid + '", pid)
526 event_config = self._download_json(
527 self._DATA_URL_TEMPLATE % ('event_config', pid),
528 pid)['eventConfig']
529 title = self._live_title(event_config['eventTitle'])
530 source_url = self._download_json(
531 self._DATA_URL_TEMPLATE % ('live_sources', pid),
532 pid)['videoSources'][0]['sourceUrl']
533 media_token = self._extract_mvpd_auth(
534 url, pid, event_config.get('requestorId', 'NBCOlympics'), resource)
535 formats = self._extract_m3u8_formats(self._download_webpage(
536 'http://sp.auth.adobe.com/tvs/v1/sign', pid, query={
537 'cdn': 'akamai',
538 'mediaToken': base64.b64encode(media_token.encode()),
539 'resource': base64.b64encode(resource.encode()),
540 'url': source_url,
541 }), pid, 'mp4')
542 self._sort_formats(formats)
543
544 return {
545 'id': pid,
546 'display_id': display_id,
547 'title': title,
548 'formats': formats,
549 'is_live': True,
550 }