mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-07 03:26:59 +00:00
Add live dash support
This commit is contained in:
parent
6251555f1c
commit
a746212d7b
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_urllib_parse_urlparse
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
@ -262,7 +263,15 @@ def _real_extract(self, url):
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native'))
|
sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native'))
|
||||||
if str_or_none(sources.get('source_dash')):
|
if str_or_none(sources.get('source_dash')):
|
||||||
pass
|
parsed_base_dash = compat_urllib_parse_urlparse(stream_meta['stream_dash_url'])
|
||||||
|
token_json = self._download_json(
|
||||||
|
'https://www.vidio.com/live/%s/tokens?type=dash' % video_id,
|
||||||
|
display_id, note='Downloading DASH token JSON', data=b'')
|
||||||
|
parsed_tokenized_dash = parsed_base_dash._replace(path=token_json.get('token', '')
|
||||||
|
+ (parsed_base_dash.path if parsed_base_dash.path[0] == '/'
|
||||||
|
else '/' + parsed_base_dash.path))
|
||||||
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
parsed_tokenized_dash.geturl(), display_id, 'dash'))
|
||||||
else:
|
else:
|
||||||
if stream_meta.get('stream_token_url'):
|
if stream_meta.get('stream_token_url'):
|
||||||
token_json = self._download_json(
|
token_json = self._download_json(
|
||||||
|
@ -272,7 +281,15 @@ def _real_extract(self, url):
|
||||||
stream_meta['stream_token_url'] + '?' + token_json.get('token', ''),
|
stream_meta['stream_token_url'] + '?' + token_json.get('token', ''),
|
||||||
display_id, 'mp4', 'm3u8_native'))
|
display_id, 'mp4', 'm3u8_native'))
|
||||||
if stream_meta.get('stream_dash_url'):
|
if stream_meta.get('stream_dash_url'):
|
||||||
pass
|
parsed_base_dash = compat_urllib_parse_urlparse(stream_meta['stream_dash_url'])
|
||||||
|
token_json = self._download_json(
|
||||||
|
'https://www.vidio.com/live/%s/tokens?type=dash' % video_id,
|
||||||
|
display_id, note='Downloading DASH token JSON', data=b'')
|
||||||
|
parsed_tokenized_dash = parsed_base_dash._replace(path=token_json.get('token', '')
|
||||||
|
+ (parsed_base_dash.path if parsed_base_dash.path[0] == '/'
|
||||||
|
else '/' + parsed_base_dash.path))
|
||||||
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
parsed_tokenized_dash.geturl(), display_id, 'dash'))
|
||||||
if stream_meta.get('stream_url'):
|
if stream_meta.get('stream_url'):
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native'))
|
stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native'))
|
||||||
|
|
Loading…
Reference in a new issue