From a746212d7b2e65d464c985d45e493298776874d7 Mon Sep 17 00:00:00 2001 From: MinePlayersPE Date: Tue, 24 Aug 2021 07:42:22 +0700 Subject: [PATCH 1/3] Add live dash support --- yt_dlp/extractor/vidio.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/vidio.py b/yt_dlp/extractor/vidio.py index 571448bf2..4d0581857 100644 --- a/yt_dlp/extractor/vidio.py +++ b/yt_dlp/extractor/vidio.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from .common import InfoExtractor +from ..compat import compat_urllib_parse_urlparse from ..utils import ( clean_html, ExtractorError, @@ -262,7 +263,15 @@ class VidioLiveIE(VidioBaseIE): formats.extend(self._extract_m3u8_formats( sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native')) 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: if stream_meta.get('stream_token_url'): token_json = self._download_json( @@ -272,7 +281,15 @@ class VidioLiveIE(VidioBaseIE): stream_meta['stream_token_url'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native')) 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'): formats.extend(self._extract_m3u8_formats( stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native')) From deab7eb786e7b32c5ae8ab568e59523ea430ecfa Mon Sep 17 00:00:00 2001 From: MinePlayersPE Date: Tue, 24 Aug 2021 09:18:27 +0700 Subject: [PATCH 2/3] Update vidio.py --- yt_dlp/extractor/vidio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/vidio.py b/yt_dlp/extractor/vidio.py index 4d0581857..cb41d2a7b 100644 --- a/yt_dlp/extractor/vidio.py +++ b/yt_dlp/extractor/vidio.py @@ -262,8 +262,8 @@ class VidioLiveIE(VidioBaseIE): display_id, note='Downloading HLS token JSON', data=b'') formats.extend(self._extract_m3u8_formats( sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native')) - if str_or_none(sources.get('source_dash')): - parsed_base_dash = compat_urllib_parse_urlparse(stream_meta['stream_dash_url']) + if str_or_none(sources.get('source_dash')): # TODO: Find live example with source_dash + parsed_base_dash = compat_urllib_parse_urlparse(sources['source_dash']) 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'') From 50306a11ebbccb411fbae1dd193b024cce8abebb Mon Sep 17 00:00:00 2001 From: MinePlayersPE Date: Tue, 24 Aug 2021 09:19:32 +0700 Subject: [PATCH 3/3] linter --- yt_dlp/extractor/vidio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/vidio.py b/yt_dlp/extractor/vidio.py index cb41d2a7b..5ef5ca969 100644 --- a/yt_dlp/extractor/vidio.py +++ b/yt_dlp/extractor/vidio.py @@ -262,7 +262,7 @@ class VidioLiveIE(VidioBaseIE): display_id, note='Downloading HLS token JSON', data=b'') formats.extend(self._extract_m3u8_formats( sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native')) - if str_or_none(sources.get('source_dash')): # TODO: Find live example with source_dash + if str_or_none(sources.get('source_dash')): # TODO: Find live example with source_dash parsed_base_dash = compat_urllib_parse_urlparse(sources['source_dash']) token_json = self._download_json( 'https://www.vidio.com/live/%s/tokens?type=dash' % video_id,