đợt này đang nghịch cái MPV, share cho các bác một vài cái mình mày mò ra được:
- Mở mấy trang IPTV kiểu như :
https://playlist.vthanhtivi.pw/
+ Chỉnh trong handles.json như vụ bác gầy chỉnh để thêm cái protocol mpv, thêm dòng này vào:
Code:
"audio/x-mpegurl": {
"action": 2,
"extensions": [
"m3u"
],
"handlers": [
{
"name": "mpv.exe",
"path": "D:\\SETUPS\\Portable\\mpv\\mpv.exe"
}
]
}
Sửa cái đường dẫn theo vị trí các bác đặt mpv là được.
View attachment 2288120
Hoặc nhanh thì có thể vào trong settings, đổi cái options phía dưới để nó hỏi lại làm thế nào để làm khi mở file.
View attachment 2288124
+ Dùng Header editor để ep content type cho trang web về : audio/x-mpegurl
View attachment 2288129
=> Sau khi làm xong, thử mở link
https://playlist.vthanhtivi.pw/ ngay từ trình duyệt. Trong trường hợp sửa qua handlers.json, nó sẽ auto mở ra mpv, các bác có thể chọn kênh trong playlist luôn.
Trong trường hợp sửa qua options trong setting, nó sẽ mở popup để các bác chọn open định dạng này ntn, các bác chọn đến mpv là xong.
View attachment 2288139
Kết quả sẽ như thế này:
iptv-mpv (https://streamable.com/nxlfzw)
- Share các bác thêm cái script để mở mpv từ màn hình youtube bằng chuột phải ( yêu cầu dùng scriptcat chứ violentmonkey nó không support cái này), mình thích dùng cái này nên làm thôi, chứ nó không support được nhiều thứ như script của bác gầy đâu, khuyên các bác vẫn nên dùng script của bác gầy nhé.
Code:
// ==UserScript==
// @name Youtube 2 MPV
// @version 1.0.1
// @author Ranko
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @match *://*/*
// ==/UserScript==
(function() {
'use strict';
var ytLink = '';
var menuCommand = '';
function btoaUrl(url) {
return btoa(url).replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
}
function genMPVLink(url, location) {
if (url == '') {
return null;
} else {
return 'mpv://play/' + btoaUrl(url) + '/' + "?referer=" + btoaUrl(location);
}
}
function getParentByTagName(e, tagName) {
tagName = tagName.toLowerCase();
if (e.tagName.toLowerCase() == tagName) {
return e;
}
while (e && e.parentNode) {
e = e.parentNode;
if (e.tagName && e.tagName.toLowerCase() == tagName) {
return e;
}
}
return "undefined";
}
function openMPV() {
if (ytLink !== null) {
var mpvLink = genMPVLink(ytLink, location.href);
if (mpvLink !== null) {
location.href = mpvLink;
}
}
}
function getLink(e) {
var target = getParentByTagName(e.target, "A").href;
if (target.includes("www.youtube.com/watch?")) {
ytLink = target;
menuCommand = GM_registerMenuCommand("Open in MPV", openMPV, "e");
} else {
ytLink = '';
if (menuCommand !== null) {
GM_unregisterMenuCommand(menuCommand);
}
}
}
document.addEventListener('contextmenu', getLink, false);
})();
=> Kết quả sẽ như thế này :
View attachment 2288162