vimeo.lua: Improve URL probe function
authorMarvin Scholz <epirat07@gmail.com>
Tue, 25 Oct 2016 07:47:51 +0000 (09:47 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 25 Oct 2016 20:14:00 +0000 (23:14 +0300)
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@atch.se>
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
share/lua/playlist/vimeo.lua

index a323249..4819fbd 100644 (file)
 
 -- 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