Add the possibility to add 'hls' later

This commit is contained in:
Bart Broere 2024-03-01 15:28:14 +01:00
parent fb7b7179ff
commit f9e59b0c49

View File

@ -82,9 +82,9 @@ class NPOIE(InfoExtractor):
title = entry.get('title') title = entry.get('title')
synopsis = entry.get('synopsis', {}) synopsis = entry.get('synopsis', {})
description = ( description = (
synopsis.get('long') synopsis.get('long')
or synopsis.get('short') or synopsis.get('short')
or synopsis.get('brief') or synopsis.get('brief')
) )
thumbnails = entry.get('images') thumbnails = entry.get('images')
for thumbnail_entry in thumbnails: for thumbnail_entry in thumbnails:
@ -95,26 +95,29 @@ class NPOIE(InfoExtractor):
token = self._get_token(product_id) token = self._get_token(product_id)
stream_link = self._download_json( formats = []
'https://prod.npoplayer.nl/stream-link', video_id=slug, for profile in (
data=json.dumps({ 'dash',
'profileName': 'dash', # 'hls', # TODO test what needs to change for 'hls' support
'drmType': 'widevine', ):
'referrerUrl': url, stream_link = self._download_json(
}).encode('utf8'), 'https://prod.npoplayer.nl/stream-link', video_id=slug,
headers={ data=json.dumps({
'Authorization': token, 'profileName': profile,
'Content-Type': 'application/json', 'drmType': 'widevine',
} 'referrerUrl': url,
) }).encode('utf8'),
headers={
# TODO other formats than dash / mpd 'Authorization': token,
stream_url = stream_link.get('stream', {}).get('streamURL') 'Content-Type': 'application/json',
mpd = self._extract_mpd_formats(stream_url, slug, mpd_id='dash', fatal=False) }
)
stream_url = stream_link.get('stream', {}).get('streamURL')
formats.extend(self._extract_mpd_formats(stream_url, slug, mpd_id='dash', fatal=False))
return { return {
'id': slug, 'id': slug,
'formats': mpd, 'formats': formats,
'title': title or slug, 'title': title or slug,
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,