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

Pierre Ynard git at videolan.org
Sat Jun 15 15:58:23 CEST 2019


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Jun 15 15:32:16 2019 +0200| [6a5e7b0f2900b1198af75655411c612e9e40f9ae] | 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a5e7b0f2900b1198af75655411c612e9e40f9ae
---

 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