vlc | branch: master | Pierre Ynard <linkfa...@yahoo.fr> | Sun Jan 27 05:09:11 2019 +0100| [cff0b2e9b7416910931baa0feeb17a99d44ed019] | committer: Pierre Ynard
vimeo.lua: support HTML player page The config API is at a slightly different URL, but both are supported now. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cff0b2e9b7416910931baa0feeb17a99d44ed019 --- share/lua/playlist/vimeo.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua index fafc24852e..6cc332e2ab 100644 --- a/share/lua/playlist/vimeo.lua +++ b/share/lua/playlist/vimeo.lua @@ -52,12 +52,22 @@ function parse() return { } else -- API URL + -- The /config API will return the data on a single line. + -- Otherwise, search the web page for the config. + local config = vlc.readline() + while true do + local line = vlc.readline() + if not line then break end + if string.match( line, "var config = {" ) then + config = line + break + end + end local prefres = vlc.var.inherit(nil, "preferred-resolution") local bestres = nil - local line = vlc.readline() -- data is on one line only - for stream in string.gmatch( line, "{([^}]*\"profile\":[^}]*)}" ) do + for stream in string.gmatch( config, "{([^}]*\"profile\":[^}]*)}" ) do local url = string.match( stream, "\"url\":\"(.-)\"" ) if url then -- Apparently the different formats available are listed @@ -84,10 +94,10 @@ function parse() return { } end - local name = string.match( line, "\"title\":\"(.-)\"" ) - local artist = string.match( line, "\"owner\":{[^}]-\"name\":\"(.-)\"" ) - local arturl = string.match( line, "\"thumbs\":{\"[^\"]+\":\"(.-)\"" ) - local duration = string.match( line, "\"duration\":(%d+)[,}]" ) + local name = string.match( config, "\"title\":\"(.-)\"" ) + local artist = string.match( config, "\"owner\":{[^}]-\"name\":\"(.-)\"" ) + local arturl = string.match( config, "\"thumbs\":{\"[^\"]+\":\"(.-)\"" ) + local duration = string.match( config, "\"duration\":(%d+)[,}]" ) return { { path = path; name = name; artist = artist; arturl = arturl; duration = duration } } end _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits