[vlc-commits] vimeo.lua: parse fully-parametered API URL from web page
Pierre Ynard
git at videolan.org
Fri Mar 29 04:31:42 CET 2019
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Mar 29 04:25:56 2019 +0100| [f540af2f722921e689ba0ff57f7d392d94940d50] | 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f540af2f722921e689ba0ff57f7d392d94940d50
---
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
More information about the vlc-commits
mailing list