[jsinterp] Fix splice to handle float

Needed for new youtube js player f1ca6900
Closes #1767
pull/1778/head
pukkandan 3 years ago
parent e5d731f35d
commit 57dbe8077f
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

@ -78,6 +78,10 @@ _NSIG_TESTS = [
'https://www.youtube.com/s/player/2dfe380c/player_ias.vflset/en_US/base.js',
'oBo2h5euWy6osrUt', '3DIBbn3qdQ',
),
(
'https://www.youtube.com/s/player/f1ca6900/player_ias.vflset/en_US/base.js',
'cu3wyu6LQn2hse', 'jvxetvmlI9AN9Q',
),
]

@ -397,7 +397,7 @@ class JSInterpreter(object):
elif member == 'splice':
assertion(isinstance(obj, list), 'must be applied on a list')
assertion(argvals, 'takes one or more arguments')
index, howMany = (argvals + [len(obj)])[:2]
index, howMany = map(int, (argvals + [len(obj)])[:2])
if index < 0:
index += len(obj)
add_items = argvals[2:]

Loading…
Cancel
Save