summaryrefslogtreecommitdiffstats
path: root/yt_dlp/jsinterp.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--yt_dlp/jsinterp.py6
1 files changed, 3 insertions, 3 deletions
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')