-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathytproxy.lua
More file actions
38 lines (31 loc) · 1.01 KB
/
ytproxy.lua
File metadata and controls
38 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local function init()
-- Print current working directory
local cwd = mp.get_property("working-directory")
mp.msg.info("Current Working Directory: " .. cwd)
print(cwd)
local url = mp.get_property("stream-open-filename")
-- check for youtube link
if url:find("^https:") == nil or url:find("youtu") == nil then
return
end
local proxy = mp.get_property("http-proxy")
if proxy and proxy ~= "" and proxy ~= "http://127.0.0.1:12081" then
return
end
-- launch mitm proxy
local args = {
cwd .. "\\http-ytproxy\\run.vbs"
}
mp.command_native_async({
name = "subprocess",
capture_stdout = false,
playback_only = false,
args = args,
});
mp.set_property("http-proxy", "http://127.0.0.1:12081")
mp.set_property("tls-verify", "no")
-- this is not really needed
--mp.set_property("tls-verify", "yes")
--mp.set_property("tls-ca-file", scriptPath .. "/cert.pem")
end
mp.register_event("start-file", init)