[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: vocaroo.lua: pass HTTP referrer to media URL request

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sat Sep 3 09:12:44 UTC 2022



Rémi Denis-Courmont pushed to branch 3.0.x at VideoLAN / VLC


Commits:
0c8461b9 by Pierre Ynard at 2022-09-03T08:50:38+00:00
vocaroo.lua: pass HTTP referrer to media URL request

Since last month, requests without a valid referrer get rejected with an
HTTP 403 error.

We might want to consider that the lua script API should track and pass
such referrers by itself.

(cherry picked from commit 3c9c32ab3bd0258aa55bd353609c96846ce21373)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

- - - - -
3f03bd04 by Pierre Ynard at 2022-09-03T08:50:38+00:00
youtube.lua: fix crash on unexpected "n" descrambling transformation code

It was possible, when encountering different code from what was expected
for some known transformations, to void the code parsing pointer instead
of advancing it, resulting in a subsequent crash of the script and total
playback failure. Add a fallback and check, to prevent and gracefully
deal with this, and still allow playback, even if throttled, in case of
descrambling failure.

(cherry picked from commit 149444107513953b46f52675cea0408f324d4c04)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

- - - - -
00bd1f2d by Pierre Ynard at 2022-09-03T08:50:38+00:00
youtube.lua: don't silently fail on "n" descrambling script parsing

The descrambling script section was updated from a simple and linear
chain of calls, to a complex execution tree with conditional branches.
Failure to recognize and parse this call structure (or lack thereof)
resulted in a silent no-op. Add a check to properly report an error.

Ref #27227

(cherry picked from commit b735ef2cde0e5b982ff157aff59199eeca9b3a71)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

- - - - -
33b0b524 by Pierre Ynard at 2022-09-03T08:50:38+00:00
youtube.lua: bump up severity of "n" parameter throttling warning

Due to the severely increased complexity of "n" descrambling code, a
quick fix is unfortunately not foreseeable. For now, let users know more
clearly what's going on and what's to expect or not.

Ref #27227

(cherry picked from commit 90dcfa0e78081770ecbd0a072b96a277aea4a214)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

- - - - -


2 changed files:

- share/lua/playlist/vocaroo.lua
- share/lua/playlist/youtube.lua


Changes:

=====================================
share/lua/playlist/vocaroo.lua
=====================================
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2016, 2019-2020 the VideoLAN team
+ Copyright © 2016, 2019-2020, 2022 the VideoLAN team
 
  Authors: Pierre Ynard
 
@@ -39,6 +39,6 @@ function parse()
         or "//media.vocaroo.com/mp3/"
 
     local path = vlc.access..":"..cdn..id
-    return { { path = path } }
+    return { { path = path; options = { ":http-referrer="..vlc.access.."://"..vlc.path } } }
 end
 


=====================================
share/lua/playlist/youtube.lua
=====================================
@@ -371,7 +371,7 @@ function n_descramble( nparam, js )
     -- as such into a table.
     local data = {}
     datac = datac..","
-    while datac ~= "" do
+    while datac and datac ~= "" do
         local el = nil
         -- Transformation functions
         if string.match( datac, "^function%(" ) then
@@ -397,6 +397,7 @@ function n_descramble( nparam, js )
                el == trans.compound1.func or
                el == trans.compound2.func then
                 datac = string.match( datac, '^.-},e%.split%(""%)%)},(.*)$' )
+                        or string.match( datac, "^.-},(.*)$" )
             else
                 datac = string.match( datac, "^.-},(.*)$" )
             end
@@ -460,6 +461,10 @@ function n_descramble( nparam, js )
     -- as a second argument. We parse and emulate those calls to follow
     -- the descrambling script.
     -- c[40](c[14],c[2]),c[25](c[48]),c[14](c[1],c[24],c[42]()), [...]
+    if not string.match( script, "c%[(%d+)%]%(c%[(%d+)%]([^)]-)%)" ) then
+        vlc.msg.dbg( "Couldn't parse and execute YouTube video throttling parameter descrambling rules" )
+        return nil
+    end
     for ifunc, itab, args in string.gmatch( script, "c%[(%d+)%]%(c%[(%d+)%]([^)]-)%)" ) do
         local iarg1 = string.match( args, "^,c%[(%d+)%]" )
         local iarg2 = string.match( args, "^,[^,]-,c%[(%d+)%]" )
@@ -704,8 +709,8 @@ function pick_stream( stream_map, js_url )
         if dn then
             url = string.gsub( url, "([?&])n=[^&]+", "%1n="..vlc.strings.encode_uri_component( dn ), 1 )
         else
-            vlc.msg.dbg( "Couldn't descramble YouTube throttling URL parameter: data transfer will get throttled" )
-            vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
+            vlc.msg.err( "Couldn't descramble YouTube throttling URL parameter: data transfer will get throttled" )
+            --vlc.msg.err( "Couldn't process youtube video URL, please check for updates to this script" )
         end
     end
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c9ab8c60248a3ca898b003d9c7cb26b9eab12f1d...33b0b524b166f9ffd4b635d8a929ec8181d11578

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c9ab8c60248a3ca898b003d9c7cb26b9eab12f1d...33b0b524b166f9ffd4b635d8a929ec8181d11578
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list