From ebe832dc3777861fd20e38cf7588013e9df80e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= Date: Thu, 24 Jul 2014 11:08:31 +0200 Subject: [PATCH] [jsinterp] 'reverse' modifies the array in place (fixes #3334) --- test/test_youtube_signature.py | 8 +++++++- youtube_dl/jsinterp.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index f0f33f1db..8f1afd432 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -62,7 +62,13 @@ u'js', 84, u'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ0STUVWXYZ!"#$%&\'()*+,@./:;<=>' - ) + ), + ( + u'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl9FYC6l.js', + u'js', + 83, + u'123456789abcdefghijklmnopqr0tuvwxyzABCDETGHIJKLMNOPQRS>UVWXYZ!"#$%&\'()*+,-./:;<=F' + ), ] diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py index 34e5307fa..95e6948ff 100644 --- a/youtube_dl/jsinterp.py +++ b/youtube_dl/jsinterp.py @@ -98,7 +98,8 @@ def interpret_expression(self, expr, local_vars, allow_recursion): return argvals[0].join(obj) if member == 'reverse': assert len(argvals) == 0 - return obj[::-1] + obj.reverse() + return obj if member == 'slice': assert len(argvals) == 1 return obj[argvals[0]:]