From 15f22b4880b6b3f71f350c64d70976ae65b9f1ca Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 29 Nov 2023 00:20:06 +0100 Subject: [PATCH 1/3] [webvtt] Allow spaces before newlines for CueBlock (#7681) Closes #7453 Ref: https://www.w3.org/TR/webvtt1/#webvtt-cue-block --- yt_dlp/webvtt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yt_dlp/webvtt.py b/yt_dlp/webvtt.py index dd72982778..596e9bf738 100644 --- a/yt_dlp/webvtt.py +++ b/yt_dlp/webvtt.py @@ -95,6 +95,7 @@ _REGEX_TS = re.compile(r'''(?x) _REGEX_EOF = re.compile(r'\Z') _REGEX_NL = re.compile(r'(?:\r\n|[\r\n]|$)') _REGEX_BLANK = re.compile(r'(?:\r\n|[\r\n])+') +_REGEX_OPTIONAL_WHITESPACE = re.compile(r'[ \t]*') def _parse_ts(ts): @@ -285,6 +286,7 @@ class CueBlock(Block): m1 = parser.consume(_REGEX_TS) if not m1: return None + parser.consume(_REGEX_OPTIONAL_WHITESPACE) m2 = parser.consume(cls._REGEX_SETTINGS) if not parser.consume(_REGEX_NL): return None From a174c453ee1e853c584ceadeac17eef2bd433dc5 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 29 Nov 2023 03:18:17 +0530 Subject: [PATCH 2/3] Let `read_stdin` obey `--quiet` Closes #8668 --- yt_dlp/__init__.py | 10 ++++++---- yt_dlp/utils/_utils.py | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index 446f0c47b9..57a4871575 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -73,14 +73,16 @@ def _exit(status=0, *args): def get_urls(urls, batchfile, verbose): - # Batch file verification + """ + @param verbose -1: quiet, 0: normal, 1: verbose + """ batch_urls = [] if batchfile is not None: try: batch_urls = read_batch_urls( - read_stdin('URLs') if batchfile == '-' + read_stdin(None if verbose == -1 else 'URLs') if batchfile == '-' else open(expand_path(batchfile), encoding='utf-8', errors='ignore')) - if verbose: + if verbose == 1: write_string('[debug] Batch file urls: ' + repr(batch_urls) + '\n') except OSError: _exit(f'ERROR: batch file {batchfile} could not be read') @@ -721,7 +723,7 @@ ParsedOptions = collections.namedtuple('ParsedOptions', ('parser', 'options', 'u def parse_options(argv=None): """@returns ParsedOptions(parser, opts, urls, ydl_opts)""" parser, opts, urls = parseOpts(argv) - urls = get_urls(urls, opts.batchfile, opts.verbose) + urls = get_urls(urls, opts.batchfile, -1 if opts.quiet and not opts.verbose else opts.verbose) set_compat_opts(opts) try: diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index b0164a8953..f1d7cead66 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -4789,8 +4789,9 @@ def parse_http_range(range): def read_stdin(what): - eof = 'Ctrl+Z' if compat_os_name == 'nt' else 'Ctrl+D' - write_string(f'Reading {what} from STDIN - EOF ({eof}) to end:\n') + if what: + eof = 'Ctrl+Z' if compat_os_name == 'nt' else 'Ctrl+D' + write_string(f'Reading {what} from STDIN - EOF ({eof}) to end:\n') return sys.stdin From 6a9c7a2b52655bacfa7ab2da24fd0d14a6fff495 Mon Sep 17 00:00:00 2001 From: OIRNOIR <70721372+OIRNOIR@users.noreply.github.com> Date: Wed, 29 Nov 2023 04:48:58 -0800 Subject: [PATCH 3/3] [ie/youtube] Support cf.piped.video (#8514) Authored by: OIRNOIR Closes #8457 --- yt_dlp/extractor/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 449d9d1a56..b6212646eb 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -428,7 +428,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor): r'(?:www\.)?piped\.adminforge\.de', r'(?:www\.)?watch\.whatevertinfoil\.de', r'(?:www\.)?piped\.qdi\.fi', - r'(?:www\.)?piped\.video', + r'(?:(?:www|cf)\.)?piped\.video', r'(?:www\.)?piped\.aeong\.one', r'(?:www\.)?piped\.moomoo\.me', r'(?:www\.)?piped\.chauvet\.pro',