Support _non_-tokenized source URLs too

This commit is contained in:
nikhil 2021-08-03 00:16:23 -04:00
parent b675a6e6b9
commit ce604ae7dc

View File

@ -477,7 +477,9 @@ class NBCOlympicsIE(InfoExtractor):
class NBCOlympicsStreamIE(AdobePassIE):
IE_NAME = 'nbcolympics:stream'
_VALID_URL = r'https?://stream\.nbcolympics\.com/(?P<id>[0-9a-z-]+)'
_TEST = {
_TESTS = [
# "Tokenized" .m3u8 source URL
{
'url': 'https://stream.nbcolympics.com/womens-soccer-group-round-11',
'info_dict': {
'id': '2019740',
@ -488,7 +490,21 @@ class NBCOlympicsStreamIE(AdobePassIE):
# m3u8 download
'skip_download': True,
},
}
},
# Plain .m3u8 source URL
{
'url': 'https://stream.nbcolympics.com/gymnastics-event-finals-mens-floor-pommel-horse-womens-vault-bars',
'info_dict': {
'id': '2021729',
'ext': 'mp4',
'title': r're:Event Finals: M Floor, W Vault, M Pommel, W Uneven Bars [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
},
'params': {
# m3u8 download
'skip_download': True,
},
},
]
_DATA_URL_TEMPLATE = 'http://stream.nbcolympics.com/data/%s_%s.json'
_LEAP_URL_TEMPLATE = 'https://api-leap.nbcsports.com/feeds/assets/%s?application=NBCOlympics&platform=%s&format=nbc-player&env=staging'
@ -521,7 +537,8 @@ class NBCOlympicsStreamIE(AdobePassIE):
media_token = self._extract_mvpd_auth(
url, pid, event_config.get('requestorId', 'NBCOlympics'), ap_resource)
tokenized_url = self._download_json(
if event_config.get('cdnToken') is True:
source_url = self._download_json(
'https://tokens.playmakerservices.com/',
pid,
'Retrieving tokenized URL',
@ -543,7 +560,7 @@ class NBCOlympicsStreamIE(AdobePassIE):
}).encode(),
)['akamai'][0]['tokenizedUrl']
formats = self._extract_m3u8_formats(tokenized_url, pid, 'mp4')
formats = self._extract_m3u8_formats(source_url, pid, 'mp4')
for f in formats:
f['_seekable'] = False
f['_http_seekable'] = False