summaryrefslogtreecommitdiffstats
path: root/yt_dlp/jsinterp.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:24:34 +0000
commitc94c26ea350ce21e663a84b0177aedce9cd93bb8 (patch)
tree9de0d239b35411e1fa6feaf05e26b3f4483adad2 /yt_dlp/jsinterp.py
parentAdding debian version 2024.08.01-1. (diff)
downloadyt-dlp-c94c26ea350ce21e663a84b0177aedce9cd93bb8.tar.xz
yt-dlp-c94c26ea350ce21e663a84b0177aedce9cd93bb8.zip
Merging upstream version 2024.08.06.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/jsinterp.py')
-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')