[vlc-commits] youtube.lua: clean up outdated DNS logic from probing

Pierre Ynard git at videolan.org
Mon Oct 24 08:19:49 CEST 2016


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Oct 24 07:54:30 2016 +0200| [53dcda7f432f3b33d4d565fe3a80c933552f461b] | committer: Pierre Ynard

youtube.lua: clean up outdated DNS logic from probing

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

 share/lua/playlist/youtube.lua | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index e336ebd..310775f 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -225,25 +225,16 @@ end
 
 -- Probe function.
 function probe()
-    if vlc.access ~= "http" and vlc.access ~= "https" then
-        return false
-    end
-    youtube_site = string.match( string.sub( vlc.path, 1, 8 ), "youtube" )
-    if not youtube_site then
-        -- FIXME we should be using a builtin list of known youtube websites
-        -- like "fr.youtube.com", "uk.youtube.com" etc..
-        youtube_site = string.find( vlc.path, ".youtube.com" )
-        if youtube_site == nil then
-            return false
-        end
-    end
-    return (  string.match( vlc.path, "/watch%?" ) -- the html page
+    return ( ( vlc.access == "http" or vlc.access == "https" )
+             and string.match( vlc.path, "^www%.youtube%.com/" )
+             and (
+               string.match( vlc.path, "/watch%?" ) -- the html page
             or string.match( vlc.path, "/live$" ) -- user live stream html page
             or string.match( vlc.path, "/live%?" ) -- user live stream html page
             or string.match( vlc.path, "/get_video_info%?" ) -- info API
             or string.match( vlc.path, "/v/" ) -- video in swf player
             or string.match( vlc.path, "/embed/" ) -- embedded player iframe
-           )
+             ) )
 end
 
 -- Parse function.



More information about the vlc-commits mailing list