[vlc-commits] Fix for vimeo parser to handle multi-line data block

Stephen Parry git at videolan.org
Thu Feb 28 09:16:54 CET 2013


vlc/vlc-2.0 | branch: master | Stephen Parry <sgparry at mainscreen.com> | Thu Feb 28 00:17:22 2013 +0000| [635b7943424a237d3c36e1555a17b6b9ed803a27] | committer: Jean-Baptiste Kempf

Fix for vimeo parser to handle multi-line data block

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 at videolan.org>
(cherry picked from commit 3853f776a3fdcc52fb4aa804b4b2cf9350516861)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/playlist/vimeo.lua |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua
index 12c2918..455e93a 100644
--- a/share/lua/playlist/vimeo.lua
+++ b/share/lua/playlist/vimeo.lua
@@ -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



More information about the vlc-commits mailing list