X-Git-Url: https://jfr.im/git/yt-dlp.git/blobdiff_plain/170605840ea9d5ad75da6576485ea7d125b428ee..7cf51f21916292cd80bdeceb37489f5322f166dd:/yt_dlp/jsinterp.py diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py index db6526009..5571ecfeb 100644 --- a/yt_dlp/jsinterp.py +++ b/yt_dlp/jsinterp.py @@ -243,7 +243,7 @@ def _separate(expr, delim=',', max_split=None): return counters = {k: 0 for k in _MATCHING_PARENS.values()} start, splits, pos, delim_len = 0, 0, 0, len(delim) - 1 - in_quote, escaping, after_op, in_regex_char_group = None, False, True, False + in_quote, escaping, after_op, in_regex_char_group, in_unary_op = None, False, True, False, False for idx, char in enumerate(expr): if not in_quote and char in _MATCHING_PARENS: counters[_MATCHING_PARENS[char]] += 1 @@ -258,9 +258,11 @@ def _separate(expr, delim=',', max_split=None): elif in_quote == '/' and char in '[]': in_regex_char_group = char == '[' escaping = not escaping and in_quote and char == '\\' - after_op = not in_quote and char in OP_CHARS or (char.isspace() and after_op) + in_unary_op = (not in_quote and not in_regex_char_group + and after_op not in (True, False) and char in '-+') + after_op = char if (not in_quote and char in OP_CHARS) else (char.isspace() and after_op) - if char != delim[pos] or any(counters.values()) or in_quote: + if char != delim[pos] or any(counters.values()) or in_quote or in_unary_op: pos = 0 continue elif pos != delim_len: