Skip to content

Instantly share code, notes, and snippets.

@spcmd
Created March 25, 2016 16:28
Show Gist options
  • Save spcmd/39da008e3c5f40fc1ee9 to your computer and use it in GitHub Desktop.
Save spcmd/39da008e3c5f40fc1ee9 to your computer and use it in GitHub Desktop.
luakit redirect youtube.com to m.youtube.com
-- 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