[vlc-commits] youtube.lua: always use long line workaround with new HTML code layout

Pierre Ynard git at videolan.org
Wed Nov 4 19:34:51 CET 2020


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov  4 19:22:10 2020 +0100| [196cb1b2296ab46e9e9558108ec91b645de7370f] | committer: Pierre Ynard

youtube.lua: always use long line workaround with new HTML code layout

This is required for the main configuration line, and possibly another
line before it. Until more is known, it seems more prudent to enable the
workaround unconditionally for now, than to try and guess what should
work correctly.

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

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

 share/lua/playlist/youtube.lua | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 68630e6ba0..b17900fd2e 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -331,7 +331,9 @@ function parse()
         -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_formats)
         fmt = get_url_param( vlc.path, "fmt" )
         while true do
-            local line = vlc.readline()
+            -- The new HTML code layout has fewer and longer lines; always
+            -- use the long line workaround until we get more visibility.
+            local line = new_layout and read_long_line() or vlc.readline()
             if not line then break end
 
             -- The next line is the major configuration line that we need.
@@ -400,10 +402,10 @@ function parse()
                 end
             end
 
-            if not nonce then
+            if not new_layout then
                 if string.match( line, '<script nonce="' ) then
                     vlc.msg.dbg( "Detected new YouTube HTML code layout" )
-                    nonce = true
+                    new_layout = true
                 end
             end
 



More information about the vlc-commits mailing list