From c94c26ea350ce21e663a84b0177aedce9cd93bb8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 7 Aug 2024 15:24:34 +0200 Subject: Merging upstream version 2024.08.06. Signed-off-by: Daniel Baumann --- yt_dlp/jsinterp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'yt_dlp/jsinterp.py') diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py index 851d4dc..ba059ba 100644 --- a/yt_dlp/jsinterp.py +++ b/yt_dlp/jsinterp.py @@ -709,9 +709,9 @@ class JSInterpreter: obj.reverse() return obj elif member == 'slice': - assertion(isinstance(obj, list), 'must be applied on a list') - assertion(len(argvals) == 1, 'takes exactly one argument') - return obj[argvals[0]:] + assertion(isinstance(obj, (list, str)), 'must be applied on a list or string') + assertion(len(argvals) <= 2, 'takes between 0 and 2 arguments') + return obj[slice(*argvals, None)] elif member == 'splice': assertion(isinstance(obj, list), 'must be applied on a list') assertion(argvals, 'takes one or more arguments') -- cgit v1.2.3