[vlc-commits] youtube.lua: handle URL-encoding of signatures when descrambling

Pierre Ynard git at videolan.org
Sat Jun 15 16:10:27 CEST 2019


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Jun 15 15:32:16 2019 +0200| [5ed96818ee992081280ec0b2c3b94361ccdb6260] | committer: Pierre Ynard

youtube.lua: handle URL-encoding of signatures when descrambling

A new signature format has been phased in, using base64 instead of
hexadecimal encoding: the base64 "=" characters need to be properly
URL-decoded from the stream map, otherwise descrambling will fail.

(cherry picked from commit 6a5e7b0f2900b1198af75655411c612e9e40f9ae)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=5ed96818ee992081280ec0b2c3b94361ccdb6260
---

 share/lua/playlist/youtube.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 9ff3339130..dbd35c56fd 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -204,6 +204,7 @@ function pick_url( url_map, fmt, js_url )
                 -- Descramble any scrambled signature and append it to URL
                 local s = string.match( stream, "s=([^&,]+)" )
                 if s then
+                    s = vlc.strings.decode_uri( s )
                     vlc.msg.err( "Found "..string.len( s ).."-character scrambled signature for youtube video URL, attempting to descramble... " )
                     if js_url then
                         s = js_descramble( s, js_url )
@@ -211,7 +212,7 @@ function pick_url( url_map, fmt, js_url )
                         vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
                     end
 
-                    url = url.."&signature="..s
+                    url = url.."&signature="..vlc.strings.encode_uri_component( s )
                 end
 
                 path = url



More information about the vlc-commits mailing list