mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-24 19:22:06 +00:00
[npr] Add support for streams (closes #24042)
This commit is contained in:
parent
f6052ec923
commit
7bf27721d6
1 changed files with 16 additions and 0 deletions
|
@ -4,6 +4,7 @@ from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
qualities,
|
qualities,
|
||||||
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +49,10 @@ class NprIE(InfoExtractor):
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
'expected_warnings': ['Failed to download m3u8 information'],
|
'expected_warnings': ['Failed to download m3u8 information'],
|
||||||
|
}, {
|
||||||
|
# multimedia, no formats, stream
|
||||||
|
'url': 'https://www.npr.org/2020/02/14/805476846/laura-stevenson-tiny-desk-concert',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -95,6 +100,17 @@ class NprIE(InfoExtractor):
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
'quality': quality(format_id),
|
'quality': quality(format_id),
|
||||||
})
|
})
|
||||||
|
for stream_id, stream_entry in media.get('stream', {}).items():
|
||||||
|
if not isinstance(stream_entry, dict):
|
||||||
|
continue
|
||||||
|
if stream_id != 'hlsUrl':
|
||||||
|
continue
|
||||||
|
stream_url = url_or_none(stream_entry.get('$text'))
|
||||||
|
if not stream_url:
|
||||||
|
continue
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
stream_url, stream_id, 'mp4', 'm3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
entries.append({
|
entries.append({
|
||||||
|
|
Loading…
Reference in a new issue