Created
March 25, 2016 16:28
-
-
Save spcmd/39da008e3c5f40fc1ee9 to your computer and use it in GitHub Desktop.
luakit redirect youtube.com to m.youtube.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Put it in your rc.lua above the "End user script loading" part. | |
-- Redirect youtube.com to m.youtube.com | |
webview.init_funcs.youtube_redirect = function (view, w) | |
view:add_signal("navigation-request", function (v, uri) | |
if string.match(uri, "^https://www%.youtube%.com/-$") then | |
v.uri = "https://m.youtube.com/?app=m" | |
return false | |
end | |
if string.match(uri, "www%.youtube%.com/watch%?v=") then | |
v.uri = uri:gsub("www","m"):gsub("&app=desktop","&app=m") | |
return false | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment