Ngủ dậy nhận hàng nhé
Đã viết xong plugin giúp MPV gửi watchtime (để Youtube nó ghi nhớ rằng video này đã xem), tạo một file tên
markwatched.lua
, rồi copy toàn bộ đống code sau vào sau đó sửa lại chút:
Code:
local msg = require 'mp.msg'
local function ytdlWatch()
local path = mp.get_property("path", "")
-- Use this website to escape LUA String Path (about:support -> Open Profile Folder -> Copy -> Paste): https://onlinestringtools.com/escape-string
-- Then replace D:\\PB\\Data\\profilet with yours
local ffpath = "firefox:D:\\PB\\Data\\profilet"
local command = { "yt-dlp", "--cookies-from-browser", ffpath, "--mark-watched", "-vU", "--simulate", path }
local ret = mp.command_native({
name = "subprocess",
args = command,
capture_stdout = true,
capture_stderr = true
})
msg.info(ret.stdout)
msg.info(ret.stderr)
end
--mp.register_event("start-file", ytdlWatch)
mp.register_event("file-loaded", ytdlWatch)
Thay thế đoạn
D:\\PB\\Data\\profilet
với đường dẫn tới profile Firefox của bạn bằng cách vào
about:support
->
Open Profile Folder
-> Copy cái đường dẫn rồi mở trang này lên
https://onlinestringtools.com/escape-string, Paste vào nó sẽ ra cái đường dẫn được escape kiểu
D:\\PB\\Data\\profilet
, thay thế cái đường dẫn mặc định
D:\\PB\\Data\\profilet
thành của bạn là xong.
Để file
markwatched.lua
vào thư mục
scripts
của MPV.
Giờ xem Youtube và nhận hậu quả.
Trái đắng:
https://gfycat.com/BoringAmusingHoneybadger
Hiện tượng: Cũng hiếm khi Youtube nó từ chối nhận thông tin lịch sử từ MPV thì Thoát tài khoản Youtube ra, xóa sạch Cookie từ Youtube đi rồi đăng nhập lại là hết. Một trường hợp đã xử lý là @Ray Gunn
Chúc vui