kiến thức Tổng hợp những addon chất cho Firefox / Chromium

Chạy cái .vbs đi fen, muốn tiện thì quăng shortcut nó vào startup rồi quên luôn,
Do nó đang ko tự chạy dc nên mới tạo file vbs đó.
:sweat:
Vậy mà không thấy đề cập tới, thử code này xem nó có tự chạy không ?

Code:
local inited = 0
local function platform_is_windows()
    return mp.get_property_native("platform") == "windows"
end

local function getOS()
    local BinaryFormat = package.cpath
    --print(BinaryFormat)
    if platform_is_windows() == "windows" then
        return "Windows"
    end
    if BinaryFormat:match("dll$") then
        return "Windows"
    elseif BinaryFormat:match("so$") then
        if BinaryFormat:match("homebrew") then
            return "MacOS"
        else
            return "Linux"
        end
    elseif BinaryFormat:match("dylib$") then
        return "MacOS"
    end
end

local function init()
    if inited == 0 then
        local url = mp.get_property("stream-open-filename")
        local osv = getOS()
        local args
        -- 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
        if getOS == 'Windows' then
            -- launch mitm proxy Win
            args = {
                mp.get_script_directory() .. "/http-ytproxy.exe",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        else
            -- launch mitm proxy Lin
            args = {
                mp.get_script_directory() .. "/http-ytproxy",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        end
  
        mp.command_native_async({
            name = "subprocess",
            capture_stdout = false,
            playback_only = false,
            args = args,
        });
        inited = 1
    end
  
    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", mp.get_script_directory() .. "/cert.pem")
end

mp.register_event("start-file", init)
--[[mp.add_hook("on_load", 1, function()
    init()
end)--]]

Code nhanh nên chưa tối ưu, cơ mà kệ ít nhất code này cũng kiểm tra xem ytproxy đã chạy chưa để không chạy lặp khi xem playlist.

Tất cả bỏ hết vào thư mục ytproxy trong scripts nhé, file này để là main.lua vì theo cấu trúc đặc biệt của MPV, file nằm trong folder có tên main.lua sẽ kích hoạt.
1719891554836.png
 
Theo hình là bị Youtube nó chặn đó, 403 là lỗi chặn đối tượng, mạng có đang bật VPN nào không ? Bởi Youtube nó sẽ chặn ai chơi VPN không khớp IP với cái ip= trong cái url đỏ đỏ trên, với lại mạng đang dùng IPv6 đó hả thì xác định IPv6 luôn chậm hơn IPv4 nhé, tối ưu thử MPV tắt IPv6 xem:

ytdl-raw-options=force-ipv4= bỏ vào mpv.conf.

TÌnh hình không thấy xi nhê gì, vẫn mất đúng 15s để load video - và speed không lên được MiB/s
Log: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv-log-20240702 1034.txt
new log: https://github.com/lamborghinipth/share/raw/main/mpv-log/mpv-log-20240702 1048.txt

File mpv.conf https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf

ytproxy thì cũng có chạy đây:
j8byCBJ.png


Hình ảnh
3d9Yf8r.jpeg
 
Last edited:
đúng là nhanh vật vã luôn. Đợi cao thủ build cho macos thui.
Thử compile cho Mac từ Linux mà hỏng, chắc đợi ai có máy Mac rồi cài Rust xong compile mới chuẩn:
Code:
sudo apt update
sudo apt install pkg-config libssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo build --release

Chắc tương tự vậy thôi.
TÌnh hình không thấy xi nhê gì, vẫn mất đúng 15s để load video - và speed không lên được MiB/s
Log: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv-log-20240702 1034.txt

File mpv.conf https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf

Hình ảnh
3d9Yf8r.jpeg
Thử làm theo bài này xem:
Vậy mà không thấy đề cập tới, thử code này xem nó có tự chạy không ?

Code:
local inited = 0
local function platform_is_windows()
    return mp.get_property_native("platform") == "windows"
end

local function getOS()
    local BinaryFormat = package.cpath
    --print(BinaryFormat)
    if platform_is_windows() == "windows" then
        return "Windows"
    end
    if BinaryFormat:match("dll$") then
        return "Windows"
    elseif BinaryFormat:match("so$") then
        if BinaryFormat:match("homebrew") then
            return "MacOS"
        else
            return "Linux"
        end
    elseif BinaryFormat:match("dylib$") then
        return "MacOS"
    end
end

local function init()
    if inited == 0 then
        local url = mp.get_property("stream-open-filename")
        local osv = getOS()
        local args
        -- 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
        if getOS == 'Windows' then
            -- launch mitm proxy Win
            args = {
                mp.get_script_directory() .. "/http-ytproxy.exe",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        else
            -- launch mitm proxy Lin
            args = {
                mp.get_script_directory() .. "/http-ytproxy",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        end
 
        mp.command_native_async({
            name = "subprocess",
            capture_stdout = false,
            playback_only = false,
            args = args,
        });
        inited = 1
    end
 
    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", mp.get_script_directory() .. "/cert.pem")
end

mp.register_event("start-file", init)
--[[mp.add_hook("on_load", 1, function()
    init()
end)--]]

Code nhanh nên chưa tối ưu, cơ mà kệ ít nhất code này cũng kiểm tra xem ytproxy đã chạy chưa để không chạy lặp khi xem playlist.

Tất cả bỏ hết vào thư mục ytproxy trong scripts nhé, file này để là main.lua vì theo cấu trúc đặc biệt của MPV, file nằm trong folder có tên main.lua sẽ kích hoạt.
View attachment 2557199
 
Thử compile cho Mac từ Linux mà hỏng, chắc đợi ai có máy Mac rồi cài Rust xong compile mới chuẩn:
Code:
sudo apt update
sudo apt install pkg-config libssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo build --release

Chắc tương tự vậy thôi.

Thử làm theo bài này xem:
chờ tí rảnh tay build cho thầy gầy.
 

Attachments

  • http-ytproxy.zip
    783.5 KB · Views: 2
chờ tí rảnh tay build cho thầy gầy.
Ngon, vậy cho Mac sẽ để là http_ytproxy vậy, do Linux và Mac dùng chung cách đặt tên sẽ không có đuôi file.

Sẽ upload lên Github kèm main.lua mới hỗ trợ Mac.

Đã xong:
 
Thử compile cho Mac từ Linux mà hỏng, chắc đợi ai có máy Mac rồi cài Rust xong compile mới chuẩn:
Code:
sudo apt update
sudo apt install pkg-config libssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo build --release

Chắc tương tự vậy thôi.

Thử làm theo bài này xem:

Đã update code vào file mpv\http-ytproxy\main.lua

Tình hình vẫn thế, vẫn 15s mới play + speed vẫn vài trăm KiB/s
(Tốc độ mạng test vẫn 250Mbps, dùng IDM vẫn 15-18MB/s mở 24 connections, xem Youtube trên Browser/ Freetube vẫn ngay lập tức -> không phải lỗi do đường truyền :( )
Log mới: https://github.com/lamborghinipth/share/raw/main/mpv-log/mpv-log-20240702 1059.txt

Hay do cái mpv.conf sai ở đâu đó thầy nhể
File mpv.conf https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf

2bw83xY.jpeg
 
Đã update code vào file mpv\http-ytproxy\main.lua

Tình hình vẫn thế, vẫn 15s mới play + speed vẫn vài trăm KiB/s
(Tốc độ mạng test vẫn 250Mbps, dùng IDM vẫn 15-18MB/s mở 24 connections, xem Youtube trên Browser/ Freetube vẫn ngay lập tức -> không phải lỗi do đường truyền :( )
Log mới: https://github.com/lamborghinipth/share/raw/main/mpv-log/mpv-log-20240702 1059.txt

Hay do cái mpv.conf sai ở đâu đó thầy nhể
File mpv.conf https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf

2bw83xY.jpeg
Hình như code lua không chạy là nguyên nhân tại sao:
[ 1.506][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value

Thử dùng main.lua bản mới nhất xem ?
 
Vậy mà không thấy đề cập tới, thử code này xem nó có tự chạy không ?

Code:
local inited = 0
local function platform_is_windows()
    return mp.get_property_native("platform") == "windows"
end

local function getOS()
    local BinaryFormat = package.cpath
    --print(BinaryFormat)
    if platform_is_windows() == "windows" then
        return "Windows"
    end
    if BinaryFormat:match("dll$") then
        return "Windows"
    elseif BinaryFormat:match("so$") then
        if BinaryFormat:match("homebrew") then
            return "MacOS"
        else
            return "Linux"
        end
    elseif BinaryFormat:match("dylib$") then
        return "MacOS"
    end
end

local function init()
    if inited == 0 then
        local url = mp.get_property("stream-open-filename")
        local osv = getOS()
        local args
        -- 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
        if getOS == 'Windows' then
            -- launch mitm proxy Win
            args = {
                mp.get_script_directory() .. "/http-ytproxy.exe",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        else
            -- launch mitm proxy Lin
            args = {
                mp.get_script_directory() .. "/http-ytproxy",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        end
 
        mp.command_native_async({
            name = "subprocess",
            capture_stdout = false,
            playback_only = false,
            args = args,
        });
        inited = 1
    end
 
    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", mp.get_script_directory() .. "/cert.pem")
end

mp.register_event("start-file", init)
--[[mp.add_hook("on_load", 1, function()
    init()
end)--]]

Code nhanh nên chưa tối ưu, cơ mà kệ ít nhất code này cũng kiểm tra xem ytproxy đã chạy chưa để không chạy lặp khi xem playlist.

Tất cả bỏ hết vào thư mục ytproxy trong scripts nhé, file này để là main.lua vì theo cấu trúc đặc biệt của MPV, file nằm trong folder có tên main.lua sẽ kích hoạt.
View attachment 2557199
confirm worked nha thím
 
Hình như code lua không chạy là nguyên nhân tại sao:
[ 1.506][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value

Thử dùng main.lua bản mới nhất xem ?
Đã download bản main.lua mới
Log mới: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv-log-20240702 1109.txt

Thầy kiểm tra thêm xem mpv.conf của em chỗ profile-cond chuẩn chưa với?
Mpv.conf: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf
JJnlzrw.jpeg


confirm worked nha thím
sao ae ai cũng làm được vậy nhể. Speed có vài MiB/s không fen?
 
Đã download bản main.lua mới
Log mới: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv-log-20240702 1109.txt

Thầy kiểm tra thêm xem mpv.conf của em chỗ profile-cond chuẩn chưa với?
Mpv.conf: https://raw.githubusercontent.com/lamborghinipth/share/main/mpv-log/mpv.conf
JJnlzrw.jpeg



sao ae ai cũng làm được vậy nhể. Speed có vài MiB/s không fen?
Xóa file ytproxy.lua cũ đi nhé, file này nó chặn không cho main.lua chạy vì nó đặt tên là ytproxy, main.lua thực chất sẽ lấy tên folder làm tên mà trùng thằng kia nên không chạy thì phải.

Mà vấn đề là file ytproxy.lua hiện tại hỏng:
Code:
[   1.037][w][ytproxy] 
[   1.037][w][ytproxy] stack traceback:
[   1.037][w][ytproxy]     mp.defaults:515: in function 'call_event_handlers'
[   1.038][w][ytproxy]     mp.defaults:557: in function 'dispatch_events'
[   1.038][w][ytproxy]     mp.defaults:508: in function <mp.defaults:507>
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d2b40
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d1990
[   1.038][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value
[   1.038][d][cplayer] Run command: enable-section, flags=64, args=[name="input_uosc", flags="allow-hide-cursor+allow-vo-dragging"]
[   1.038][v][ytdl_hook] ytdl:// hook
[   1.038][v][ytdl_hook] not a ytdl:// url
[   1.038][v][cplayer] Running hook: ytdl_hook/on_load
[   1.038][v][ytdl_hook] playlist hook
[   1.038][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_uosc", contents="", flags="force"]
[   1.038][d][ytproxy] Exiting...

Với lại chạy hay không bật Task Manager lên xem CPU của http-ytproxy.exe khi xem phim, nếu nó dùng tầm 0.5%-1% là đang chạy, không được nữa thì hỏi xem các Win thủ @nhoxbuondkny @Triều đình @ktpttd @Đuôi Chuột Ngoáy Lọ Mỡ @netorarekamisama @Imm Dragon có cách không chứ từ Linux thì nước xa không cứu được lửa gần 😔
 
Xóa file ytproxy.lua cũ đi nhé, file này nó chặn không cho main.lua chạy vì nó đặt tên là ytproxy, main.lua thực chất sẽ lấy tên folder làm tên mà trùng thằng kia nên không chạy thì phải.

Mà vấn đề là file ytproxy.lua hiện tại hỏng:
Code:
[   1.037][w][ytproxy]
[   1.037][w][ytproxy] stack traceback:
[   1.037][w][ytproxy]     mp.defaults:515: in function 'call_event_handlers'
[   1.038][w][ytproxy]     mp.defaults:557: in function 'dispatch_events'
[   1.038][w][ytproxy]     mp.defaults:508: in function <mp.defaults:507>
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d2b40
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d1990
[   1.038][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value
[   1.038][d][cplayer] Run command: enable-section, flags=64, args=[name="input_uosc", flags="allow-hide-cursor+allow-vo-dragging"]
[   1.038][v][ytdl_hook] ytdl:// hook
[   1.038][v][ytdl_hook] not a ytdl:// url
[   1.038][v][cplayer] Running hook: ytdl_hook/on_load
[   1.038][v][ytdl_hook] playlist hook
[   1.038][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_uosc", contents="", flags="force"]
[   1.038][d][ytproxy] Exiting...

Với lại chạy hay không bật Task Manager lên xem CPU của http-ytproxy.exe khi xem phim, nếu nó dùng tầm 0.5%-1% là đang chạy, không được nữa thì hỏi xem các Win thủ @nhoxbuondkny @Triều đình @ktpttd @Đuôi Chuột Ngoáy Lọ Mỡ @netorarekamisama @Imm Dragon có cách không chứ từ Linux thì nước xa không cứu được lửa gần 😔
K phải đây khầy. Do bản mpv của fence @hpa557 không có hàm
Code:
mp.get_script_directory()
nên khi concat nó bị nil.
@hpa557 fen vào release github trên của thầy tải run.vbs, http-ytproxy.exe, key.pem, cert.pem về rồi chạy file đó xong sài đoạn script này thử lại
Code:
local function init()
    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 = {
    --     mp.get_script_directory() .. "/http-ytproxy",
    --     "-c", mp.get_script_directory() .. "/cert.pem",
    --     "-k", mp.get_script_directory() .. "/key.pem",
    --     "-r", "10485760", -- range modification
    --     "-p", "12800" -- proxy port
    -- }
    -- 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", mp.get_script_directory() .. "/cert.pem")
end
mp.register_event("start-file", init)
 
K phải đây khầy. Do bản mpv của fence @hpa557 không có hàm
Code:
mp.get_script_directory()
nên khi concat nó bị nil.
@hpa557 fen vào release github trên của thầy tải run.vbs, http-ytproxy.exe, key.pem, cert.pem về rồi chạy file đó xong sài đoạn script này thử lại
Code:
local function init()
    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 = {
    --     mp.get_script_directory() .. "/http-ytproxy",
    --     "-c", mp.get_script_directory() .. "/cert.pem",
    --     "-k", mp.get_script_directory() .. "/key.pem",
    --     "-r", "10485760", -- range modification
    --     "-p", "12800" -- proxy port
    -- }
    -- 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", mp.get_script_directory() .. "/cert.pem")
end
mp.register_event("start-file", init)
Lần đầu tiên biết lại có bản MPV không có
mp.get_script_directory()
luôn, chắc tải ở xó xỉnh nào chứ mình test từ .3-.7 đều có 😔

@hpa557 Thử lại chắc là ok rồi đó.
 
Lần đầu tiên biết lại có bản MPV không có

luôn, chắc tải ở xó xỉnh nào chứ mình test từ .3-.7 đều có 😔

@hpa557 Thử lại chắc là ok rồi đó.
Hơ hơ, lạ nhể, e chưa dùng code trên nhé

Dùng theo bản update của thầy gầy, bỏ cái folder mpv\http-ytproxy đi
Rename về ytproxy rồi move nó vào mpv\scripts\
Đã lên 15MiB/s như IDM

Nhưng vẫn mất 15s để bắt đầu play chứ chưa thể nhanh như ae 3-4s được. Chỉ mới cache nhanh thôi

bIufg1Y.jpeg


====================
 
Last edited:
Nhưng vẫn mất 15s để bắt đầu play chứ chưa thể nhanh như ae 3-4s được. Chỉ mới cache nhanh thôi
Nghi ngờ do mạng đang dùng IPv6 đó, chứ tốc độ bật lên cho tới khi video chạy là tầm 4-5s là với mạng cùi bắp, 15s thì hơi bị lâu có thể nằm ở quá trình tải trang của yt-dlp, cái này thì khó debug ra nguyên nhân, file config hiện tại không có vấn đề:

Vấn đề của IPv6 chậm thì chuyên gia @nhutthanh22 rành hơn 😔
 
Xóa file ytproxy.lua cũ đi nhé, file này nó chặn không cho main.lua chạy vì nó đặt tên là ytproxy, main.lua thực chất sẽ lấy tên folder làm tên mà trùng thằng kia nên không chạy thì phải.

Mà vấn đề là file ytproxy.lua hiện tại hỏng:
Code:
[   1.037][w][ytproxy]
[   1.037][w][ytproxy] stack traceback:
[   1.037][w][ytproxy]     mp.defaults:515: in function 'call_event_handlers'
[   1.038][w][ytproxy]     mp.defaults:557: in function 'dispatch_events'
[   1.038][w][ytproxy]     mp.defaults:508: in function <mp.defaults:507>
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d2b40
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d1990
[   1.038][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value
[   1.038][d][cplayer] Run command: enable-section, flags=64, args=[name="input_uosc", flags="allow-hide-cursor+allow-vo-dragging"]
[   1.038][v][ytdl_hook] ytdl:// hook
[   1.038][v][ytdl_hook] not a ytdl:// url
[   1.038][v][cplayer] Running hook: ytdl_hook/on_load
[   1.038][v][ytdl_hook] playlist hook
[   1.038][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_uosc", contents="", flags="force"]
[   1.038][d][ytproxy] Exiting...

Với lại chạy hay không bật Task Manager lên xem CPU của http-ytproxy.exe khi xem phim, nếu nó dùng tầm 0.5%-1% là đang chạy, không được nữa thì hỏi xem các Win thủ @nhoxbuondkny @Triều đình @ktpttd @Đuôi Chuột Ngoáy Lọ Mỡ @netorarekamisama @Imm Dragon có cách không chứ từ Linux thì nước xa không cứu được lửa gần 😔
thấy tùy video nó chạy cao hay thấp thôi
hxO18FT.png


còn video này mới nhảy lên 7xx KiB/s
td1Y15a.jpeg
 
Lần đầu tiên biết lại có bản MPV không có
luôn, chắc tải ở xó xỉnh nào chứ mình test từ .3-.7 đều có 😔
Vậy giờ update bản MPV có script này ở đâu chuẩn vì e cũng theo hướng dẫn #1 #2 + config thì copy của tuilakhanh

max băng thông đó fen, có nhiêu kéo nhiêu
1719894349093.png
Đâu, max của tôi down thử ở nhiều tool rồi, mở cổng ra là cứ phải trên 10MB/s
giờ ok vụ download rồi - screenshot capture lúc 13MiB/s chứ có lúc 15, chỉ vướng vụ loading ban đầu vẫn lâu thôi

Hơ hơ, lạ nhể, e chưa dùng code trên nhé

Dùng theo bản update của thầy gầy, bỏ cái folder mpv\http-ytproxy đi
Rename về ytproxy rồi move nó vào mpv\scripts\
Đã lên 15MiB/s như IDM

Nhưng vẫn mất 15s để bắt đầu play chứ chưa thể nhanh như ae 3-4s được. Chỉ mới cache nhanh thôi

bIufg1Y.jpeg


====================


Xóa file ytproxy.lua cũ đi nhé, file này nó chặn không cho main.lua chạy vì nó đặt tên là ytproxy, main.lua thực chất sẽ lấy tên folder làm tên mà trùng thằng kia nên không chạy thì phải.

Mà vấn đề là file ytproxy.lua hiện tại hỏng:
Code:
[   1.037][w][ytproxy] 
[   1.037][w][ytproxy] stack traceback:
[   1.037][w][ytproxy]     mp.defaults:515: in function 'call_event_handlers'
[   1.038][w][ytproxy]     mp.defaults:557: in function 'dispatch_events'
[   1.038][w][ytproxy]     mp.defaults:508: in function <mp.defaults:507>
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d2b40
[   1.038][w][ytproxy]     [C]: at 0x7ff6766d1990
[   1.038][f][ytproxy] Lua error: C:/MPV/portable_config/scripts/ytproxy.lua:15: attempt to concatenate a nil value
[   1.038][d][cplayer] Run command: enable-section, flags=64, args=[name="input_uosc", flags="allow-hide-cursor+allow-vo-dragging"]
[   1.038][v][ytdl_hook] ytdl:// hook
[   1.038][v][ytdl_hook] not a ytdl:// url
[   1.038][v][cplayer] Running hook: ytdl_hook/on_load
[   1.038][v][ytdl_hook] playlist hook
[   1.038][d][cplayer] Run command: define-section, flags=64, args=[name="input_forced_uosc", contents="", flags="force"]
[   1.038][d][ytproxy] Exiting...

Với lại chạy hay không bật Task Manager lên xem CPU của http-ytproxy.exe khi xem phim, nếu nó dùng tầm 0.5%-1% là đang chạy, không được nữa thì hỏi xem các Win thủ @nhoxbuondkny @Triều đình @ktpttd @Đuôi Chuột Ngoáy Lọ Mỡ @netorarekamisama @Imm Dragon có cách không chứ từ Linux thì nước xa không cứu được lửa gần 😔


Đã xoá file mpv\portable_config\scripts\ytproxy.lua
Đã xoá folder mpv\http-ytproxy
Hiện chỉ còn duy nhất folder mpv\portable_config\scripts\ytproxy

CS0i5ZY.png


Hiện tại d
 
Last edited:
Cảm ơn 2 bác đã ok rồi.

Bác willian309 có thể giúp mình cái này k. Mở các link (youtube, m3u8,...) bằng handlers hay copy link paste vào mpv cũng không mở 2 3 mpv cùng lúc được. Mở cái thứ 2 là tắt cái 1 rồi load video thứ 2. Cảm ơn ạ.
Ngon, vậy cho Mac sẽ để là http_ytproxy vậy, do Linux và Mac dùng chung cách đặt tên sẽ không có đuôi file.

Sẽ upload lên Github kèm main.lua mới hỗ trợ Mac.

Đã xong:
 
nên khi concat nó bị nil.
@hpa557 fen vào release github trên của thầy tải run.vbs, http-ytproxy.exe, key.pem, cert.pem về rồi chạy file đó xong sài đoạn script này thử lại
Code:
local function init()
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 = {
-- mp.get_script_directory() .. "/http-ytproxy",
-- "-c", mp.get_script_directory() .. "/cert.pem",
-- "-k", mp.get_script_directory() .. "/key.pem",
-- "-r", "10485760", -- range modification
-- "-p", "12800" -- proxy port
-- }
-- 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", mp.get_script_directory() .. "/cert.pem")
end
mp.register_event("start-file", init)
Đoạn này t chưa hiểu lắm

code file main.lua hiện tại download từ release mới thầy gầy
Fen check giúp xem thiếu sót ở đâu vậy

Hiện tại tôi ngó qua thì của fen
mp.get_script_directory() .. "/http-ytproxy",

còn code thầy gầy
mp.get_script_directory() .. "/http-ytproxy.exe",

Nên chưa dám thử

Code:
local inited = 0
local function platform_is_windows()
    return mp.get_property_native("platform") == "windows"
end

local function getOS()
    local BinaryFormat = package.cpath
    --print(BinaryFormat)
    if platform_is_windows() == "windows" then
        return "Windows"
    end
    if BinaryFormat:match("dll$") then
        return "Windows"
    elseif BinaryFormat:match("so$") then
        if BinaryFormat:match("homebrew") then
            return "MacOS"
        else
            return "Linux"
        end
    elseif BinaryFormat:match("dylib$") then
        return "MacOS"
    end
end

local function init()
    if inited == 0 then
        local url = mp.get_property("stream-open-filename")
        local osv = getOS()
        local args
        -- 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
        if getOS == 'Windows' then 
            -- launch mitm proxy Win
            args = {
                mp.get_script_directory() .. "/http-ytproxy.exe",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        elseif getOS == 'MacOS' then 
            -- launch mitm proxy Mac
            args = {
                mp.get_script_directory() .. "/http_ytproxy",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        else
            -- launch mitm proxy Lin
            args = {
                mp.get_script_directory() .. "/http-ytproxy",
                "-c", mp.get_script_directory() .. "/cert.pem",
                "-k", mp.get_script_directory() .. "/key.pem",
                "-r", "10485760", -- range modification
                "-p", "12081" -- proxy port
            }
        end
   
        mp.command_native_async({
            name = "subprocess",
            capture_stdout = false,
            playback_only = false,
            args = args,
        });
        inited = 1
    end
   
    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", mp.get_script_directory() .. "/cert.pem")
end

mp.register_event("start-file", init)
--[[mp.add_hook("on_load", 1, function()
    init()
end)--]]

Cấu trúc thư mục
hQ3RMk6.png
 
Last edited:
Cảm ơn 2 bác đã ok rồi.

Bác willian309 có thể giúp mình cái này k. Mở các link (youtube, m3u8,...) bằng handlers hay copy link paste vào mpv cũng không mở 2 3 mpv cùng lúc được. Mở cái thứ 2 là tắt cái 1 rồi load video thứ 2. Cảm ơn ạ.

Bác có thể thử làm theo cách này
Code:
https://github.com/mpv-player/mpv/issues/1377#issuecomment-1653713152
 
Back
Top