[vlc-commits] youtube.lua: drop obsolete support for unscrambled signatures

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


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Jun 15 15:15:28 2019 +0200| [c4ceff997bfee89a5e287cad0e574b1c550f2786] | committer: Pierre Ynard

youtube.lua: drop obsolete support for unscrambled signatures

It seems that unscrambled signatures are now already integrated in the
video URLs provided in the stream map, thus there is no need anymore
for this code merely appending them untouched. That unscrambled "sig"
parameter used distinctly from scrambled signatures doesn't seem in use
anymore. The current javascript code doesn't seem to provide any support
for this case either.

Only properly scrambled signatures remain requiring this processing.

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

 share/lua/playlist/youtube.lua | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index c4da544803..9ff3339130 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -201,25 +201,20 @@ function pick_url( url_map, fmt, js_url )
             if url then
                 url = vlc.strings.decode_uri( url )
 
-                local sig = string.match( stream, "sig=([^&,]+)" )
-                if not sig then
-                    -- Scrambled signature
-                    sig = string.match( stream, "s=([^&,]+)" )
-                    if sig then
-                        vlc.msg.dbg( "Found "..string.len( sig ).."-character scrambled signature for youtube video URL, attempting to descramble... " )
-                        if js_url then
-                            sig = js_descramble( sig, js_url )
-                        else
-                            vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
-                        end
+                -- Descramble any scrambled signature and append it to URL
+                local s = string.match( stream, "s=([^&,]+)" )
+                if s then
+                    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 )
+                    else
+                        vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
                     end
-                end
-                local signature = ""
-                if sig then
-                    signature = "&signature="..sig
+
+                    url = url.."&signature="..s
                 end
 
-                path = url..signature
+                path = url
                 break
             end
         end



More information about the vlc-commits mailing list