Created
April 5, 2020 14:31
-
-
Save seven1240/5ad6a60e24c5d80c98dc572f30cc5736 to your computer and use it in GitHub Desktop.
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
diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua | |
index fc9a68c..49ad6f5 100644 | |
--- a/share/lua/playlist/youtube.lua | |
+++ b/share/lua/playlist/youtube.lua | |
@@ -18,6 +18,67 @@ | |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. | |
--]] | |
+local file = io.open( "y.html", "r" ) | |
+ | |
+vlc = { | |
+ access = "https", | |
+ path = "www.youtube.com/watch?v=p-l48ztYxx8", | |
+ readline = function() | |
+ return file:read( "*line" ) | |
+ end, | |
+} | |
+ | |
+vlc.strings = { | |
+ decode_uri = function(uri) | |
+ print(uri) | |
+ end, | |
+ resolve_xml_special_chars = function(uri) | |
+ print(uri) | |
+ end, | |
+} | |
+ | |
+vlc.msg = { | |
+ dbg = function(x) | |
+ print(x) | |
+ end | |
+} | |
+ | |
+vlc.var = { | |
+ inherit = function() | |
+ return 720 | |
+ end | |
+} | |
+ | |
+local function serialize(o) | |
+ local s = "" | |
+ | |
+ if type(o) == "number" then | |
+ s = s .. o | |
+ elseif type(o) == "string" then | |
+ s = s .. string.format("%q", o) | |
+ elseif type(o) == "table" then | |
+ s = s .. "{\n" | |
+ for k, v in pairs(o) do | |
+ s = s .. ' ' .. k .. ' = ' | |
+ s = s .. serialize(v) | |
+ s = s .. ",\n" | |
+ end | |
+ s = s .. "}" | |
+ elseif type(o) == "boolean" then | |
+ if o then | |
+ s = s .. "true" | |
+ else | |
+ s = s .. "false" | |
+ end | |
+ else | |
+ s = s .. " [" .. type(o) .. "]" | |
+ end | |
+ | |
+ return s | |
+end | |
+ | |
+-- file:close() | |
+ | |
-- Helper function to get a parameter's value in a URL | |
function get_url_param( url, name ) | |
local _, _, res = string.find( url, "[&?]"..name.."=([^&]*)" ) | |
@@ -226,6 +287,8 @@ end | |
-- Probe function. | |
function probe() | |
+ print(vlc.access) | |
+ print(vlc.path:match("^www%.youtube%.com/")) | |
return ( ( vlc.access == "http" or vlc.access == "https" ) | |
and string.match( vlc.path, "^www%.youtube%.com/" ) | |
and ( | |
@@ -401,3 +464,5 @@ function parse() | |
return { { path = vlc.access.."://www.youtube.com/watch?v="..video_id..copy_url_param( vlc.path, "fmt" ) } } | |
end | |
end | |
+ | |
+print(serialize(parse())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment