[vlc-commits] youtube.lua: make gaming.youtube.com subdomain support more generic

Pierre Ynard git at videolan.org
Thu Nov 12 07:36:46 CET 2020


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Nov 12 05:42:59 2020 +0100| [8aaaf5696432d07feab5a379bdfd6042fb6d50cd] | committer: Pierre Ynard

youtube.lua: make gaming.youtube.com subdomain support more generic

And mark it as out of use: gaming.youtube.com URLs now get redirected to
the main domain.

(cherry picked from commit 77f19929db1bcbc0f3a73b6edfd8f63ffb6cc56e)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8aaaf5696432d07feab5a379bdfd6042fb6d50cd
---

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

diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index 08947a86b0..77c3ae42ae 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -306,7 +306,7 @@ function probe()
     return ( ( vlc.access == "http" or vlc.access == "https" )
              and (
                string.match( vlc.path, "^www%.youtube%.com/" )
-            or string.match( vlc.path, "^gaming%.youtube%.com/" )
+            or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
              ) and (
                string.match( vlc.path, "/watch%?" ) -- the html page
             or string.match( vlc.path, "/live$" ) -- user live stream html page
@@ -319,11 +319,10 @@ end
 
 -- Parse function.
 function parse()
-    if string.match( vlc.path, "^gaming%.youtube%.com/" ) then
-        url = string.gsub( vlc.path, "^gaming%.youtube%.com", "www.youtube.com" )
-        return { { path = vlc.access.."://"..url } }
-    end
-    if string.match( vlc.path, "/watch%?" )
+    if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+        -- Skin subdomain
+        return { { path = vlc.access.."://"..string.gsub( vlc.path, "^([^/]*)/", "www.youtube.com/" ) } }
+    elseif string.match( vlc.path, "/watch%?" )
         or string.match( vlc.path, "/live$" )
         or string.match( vlc.path, "/live%?" )
     then -- This is the HTML page's URL



More information about the vlc-commits mailing list