From 57015a4a3f15b23c152ffd2d72ed9ef520664ee5 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 7 Aug 2021 11:32:15 +0530 Subject: [PATCH] [youtube] extractor-arg to show live dash formats If replay is enabled, these formats can be used to download the last 4 hours --- README.md | 1 + yt_dlp/extractor/youtube.py | 6 ++++-- yt_dlp/options.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2c4bb8f35..9f8376f59 100644 --- a/README.md +++ b/README.md @@ -1381,6 +1381,7 @@ The following extractors use this feature: * `skip`: `hls` or `dash` (or both) to skip download of the respective manifests * `player_client`: Clients to extract video data from. The main clients are `web`, `android`, `ios`, `mweb`. These also have `_music`, `_embedded`, `_agegate`, and `_creator` variants (Eg: `web_embedded`) (`mweb` has only `_agegate`). By default, `android,web` is used, but the agegate and creator variants are added as required for age-gated videos. Similarly the music variants are added for `music.youtube.com` urls. You can also use `all` to use all the clients * `player_skip`: `configs` - skip any requests for client configs and use defaults + * `include_live_dash`: Include live dash formats (These formats don't download properly) * `comment_sort`: `top` or `new` (default) - choose comment sorting mode (on YouTube's side). * `max_comments`: maximum amount of comments to download (default all). * `max_comment_depth`: maximum depth for nested comments. YouTube supports depths 1 or 2 (default). diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 46fa31a73..d5813e288 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2628,7 +2628,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor): yield dct skip_manifests = self._configuration_arg('skip') - get_dash = not is_live and 'dash' not in skip_manifests and self.get_param('youtube_include_dash_manifest', True) + get_dash = ( + (not is_live or self._configuration_arg('include_live_dash')) + and 'dash' not in skip_manifests and self.get_param('youtube_include_dash_manifest', True)) get_hls = 'hls' not in skip_manifests and self.get_param('youtube_include_hls_manifest', True) def guess_quality(f): @@ -3458,7 +3460,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): }, { 'url': 'https://www.youtube.com/channel/UCoMdktPbSTixAyNGwb-UYkQ/live', 'info_dict': { - 'id': 'FMtPN8yp5LU', # This will keep changing + 'id': '3yImotZU3tw', # This will keep changing 'ext': 'mp4', 'title': compat_str, 'uploader': 'Sky News', diff --git a/yt_dlp/options.py b/yt_dlp/options.py index b5ddbeaff..e70471282 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -1367,7 +1367,7 @@ def parseOpts(overrideArguments=None): '--no-hls-split-discontinuity', dest='hls_split_discontinuity', action='store_false', help='Do not split HLS playlists to different formats at discontinuities such as ad breaks (default)') - _extractor_arg_parser = lambda key, vals='': (key.strip().lower(), [val.strip() for val in vals.split(',')]) + _extractor_arg_parser = lambda key, vals='': (key.strip().lower().replace('-', '_'), [val.strip() for val in vals.split(',')]) extractor.add_option( '--extractor-args', metavar='KEY:ARGS', dest='extractor_args', default={}, type='str',