[vlc-commits] vimeo.lua: Improve URL probe function

Marvin Scholz git at videolan.org
Tue Oct 25 22:16:35 CEST 2016


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Oct 25 09:47:51 2016 +0200| [807fda798db06dbcabfe6af0b5d10ce4f55d46f5] | committer: Rémi Denis-Courmont

vimeo.lua: Improve URL probe function

Improve the URL probe function to not match URLs like
http://example.org/foo/vimeo.com/14537803 as those should
not be handled by this script.

Ref. #17488

Acked-by: Filip Roséen <filip at atch.se>
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 share/lua/playlist/vimeo.lua | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua
index a323249..4819fbd 100644
--- a/share/lua/playlist/vimeo.lua
+++ b/share/lua/playlist/vimeo.lua
@@ -24,10 +24,12 @@
 
 -- Probe function.
 function probe()
+    local path = vlc.path
+    path = path:gsub("^www%.", "")
     return ( vlc.access == "http" or vlc.access == "https" )
-        and ( string.match( vlc.path, "vimeo%.com/%d+$" )
-              or string.match( vlc.path, "vimeo%.com/channels/(.-)/%d+$" )
-              or string.match( vlc.path, "player%.vimeo%.com" ) )
+        and ( string.match( path, "^vimeo%.com/%d+$" )
+              or string.match( path, "^vimeo%.com/channels/(.-)/%d+$" )
+              or string.match( path, "^player%.vimeo%.com" ) )
         -- do not match other addresses,
         -- else we'll also try to decode the actual video url
 end



More information about the vlc-commits mailing list