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

Stephen Parry git at videolan.org
Thu Feb 28 09:13:10 CET 2013


vlc | branch: master | Stephen Parry <sgparry at mainscreen.com> | Thu Feb 28 00:17:22 2013 +0000| [3853f776a3fdcc52fb4aa804b4b2cf9350516861] | 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>

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

 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 448afc5..1200e44 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