vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfa...@yahoo.fr> | Fri Mar 29 04:25:56 2019 +0100| [283effb2904ca11e3b01cca75f31cbef4fadfe80] | committer: Pierre Ynard
vimeo.lua: parse fully-parametered API URL from web page Full parameters are required for compatibility with some videos. We still keep the hard-coded pattern as fallback. (cherry picked from commit f540af2f722921e689ba0ff57f7d392d94940d50) Signed-off-by: Pierre Ynard <linkfa...@yahoo.fr> > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=283effb2904ca11e3b01cca75f31cbef4fadfe80 --- share/lua/playlist/vimeo.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua index 9c08a28b43..312b7684dd 100644 --- a/share/lua/playlist/vimeo.lua +++ b/share/lua/playlist/vimeo.lua @@ -82,10 +82,29 @@ function parse() return { { path = path; name = name; artist = artist; arturl = arturl; duration = duration } } else -- Video web page - local path = string.gsub( vlc.path, "^vimeo%.com/channels/.-/(%d+)", "/%1" ) - local video_id = string.match( path, "/(%d+)" ) + local api + while true do + local line = vlc.readline() + if not line then break end + + if string.match( line, "clip_page_config = {" ) then + api = string.match( line, '"config_url":"(.-)"' ) + if api then + api = string.gsub( api, "\\/", "/" ) + break + end + end + end + + if not api then + vlc.msg.warn( "Couldn't extract vimeo API URL, falling back to preprogrammed URL pattern" ) + + local path = string.gsub( vlc.path, "^vimeo%.com/channels/.-/(%d+)", "/%1" ) + local video_id = string.match( path, "/(%d+)" ) + + api = vlc.access.."://player.vimeo.com/video/"..video_id.."/config" + end - local api = vlc.access.."://player.vimeo.com/video/"..video_id.."/config" return { { path = api } } end end _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits