mirror of https://github.com/mpv-player/mpv
ytdl_hook: move url_is_safe earlier in code
lua isn't javascript.
This commit is contained in:
parent
573bfae7e4
commit
f8263e82cc
|
@ -84,6 +84,15 @@ local function edl_escape(url)
|
||||||
return "%" .. string.len(url) .. "%" .. url
|
return "%" .. string.len(url) .. "%" .. url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function url_is_safe(url)
|
||||||
|
local proto = type(url) == "string" and url:match("^(.+)://") or nil
|
||||||
|
local safe = proto and safe_protos[proto]
|
||||||
|
if not safe then
|
||||||
|
msg.error(("Ignoring potentially unsafe url: '%s'"):format(url))
|
||||||
|
end
|
||||||
|
return safe
|
||||||
|
end
|
||||||
|
|
||||||
local function time_to_secs(time_string)
|
local function time_to_secs(time_string)
|
||||||
local ret
|
local ret
|
||||||
|
|
||||||
|
@ -223,15 +232,6 @@ local function proto_is_dash(json)
|
||||||
or json["protocol"] == "http_dash_segments"
|
or json["protocol"] == "http_dash_segments"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function url_is_safe(url)
|
|
||||||
local proto = type(url) == "string" and url:match("^(.+)://") or nil
|
|
||||||
local safe = proto and safe_protos[proto]
|
|
||||||
if not safe then
|
|
||||||
msg.error(("Ignoring potentially unsafe url: '%s'"):format(url))
|
|
||||||
end
|
|
||||||
return safe
|
|
||||||
end
|
|
||||||
|
|
||||||
local function add_single_video(json)
|
local function add_single_video(json)
|
||||||
local streamurl = ""
|
local streamurl = ""
|
||||||
local max_bitrate = 0
|
local max_bitrate = 0
|
||||||
|
|
Loading…
Reference in New Issue