]> git.sesse.net Git - vlc/commitdiff
Fix for vimeo parser to handle multi-line data block
authorStephen Parry <sgparry@mainscreen.com>
Thu, 28 Feb 2013 00:17:22 +0000 (00:17 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 28 Feb 2013 08:13:03 +0000 (09:13 +0100)
Added code to vimeo.lua parser to handle data block consisting of
multiple lines. Code now concatenates those lines together.
Note when testing: vimeo doesn't like VLC; you must use :http-user-agent
flag to impersonate browser.

Close #7148

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
share/lua/playlist/vimeo.lua

index 448afc5b793144e9ee256bedfe3be109c340e3d6..1200e445b5cdce22143e09d7426eb3b02718944b 100644 (file)
@@ -47,9 +47,18 @@ function parse()
     ishd = false
     quality = "sd"
     codec = nil
+    line2 = ""
     while true do
         line = vlc.readline()
         if not line then break end
+        if string.match( line, "{config:.*") then
+                line2 = line;
+                while not string.match( line2, "}};") do
+                        line2 = vlc.readline()
+                        if not line2 then break end
+                        line = line .. line2;
+                end
+        end
         -- Try to find the video's title
         if string.match( line, "<meta property=\"og:title\"" ) then
             _,_,name = string.find (line, "content=\"(.*)\">" )
@@ -93,6 +102,7 @@ function parse()
         if string.match( line, "{config:.*\"height\":" ) then
             _,_,height = string.find (line, "\"height\":([0-9]*)," )
         end
+        if not line2 then break end
     end
 
     if not codec then