xifangczy / cat-catch

猫抓 浏览器资源嗅探扩展 / cat-catch Browser Resource Sniffing Extension
GNU General Public License v3.0
9.25k stars 858 forks source link

N_m3u8DL-RE目前已比较稳定,请问猫爪可以开始使用N_m3u8DL-RE吗?? #155

Open zhangweildlh opened 1 year ago

zhangweildlh commented 1 year ago

猫爪一直使用的是N_m3u8DL-CLI;目前N_m3u8DL-RE已比较的稳定了,请问可以换到N_m3u8DL-RE吗?

xifangczy commented 1 year ago

现在的问题是 RE并没有完成m3u8dl://协议 https://github.com/nilaoda/N_m3u8DL-RE/issues/75

可以用一些临时解决方法 使用CLI注册协议后 用RE的程序替换掉CLI就行了。。然后自己在参数设置里设置RE的参数就行

xingkb commented 1 year ago
Task CommandLine: D:\Dev\m3u8\N_m3u8DL-RE.exe m3u8dl://4oCcaHR0cHM6Ly9obnp5LmJmdnZzLmNvbS9wbGF5L3BlbnFPcGQ3L2luZGV4Lm0zdTjigJ0=/

00:35:19.211 INFO : N_m3u8DL-RE (Beta version) 20230628
00:35:19.218 EXTRA: ffmpeg => D:\Dev\m3u8\ffmpeg.exe
00:35:19.219 INFO : 加载URL: m3u8dl://4oCcaHR0cHM6Ly9obnp5LmJmdnZzLmNvbS9wbGF5L3BlbnFPcGQ3L2luZGV4Lm0zdTjigJ0=/
00:35:19.223 ERROR: Object reference not set to an instance of an object.

m3u8DL-RE的win程序本身还不支持链接的调用。

@if (@X)==(@Y) @end /* JScript comment
    @echo off
    cscript //E:JScript //nologo "%~f0"  %*
    exit /b %errorlevel%
@if (@X)==(@Y) @end JScript comment */

//http://www.webtoolkit.info/javascript-base64.html#.WMpLPzuGOqk
var Base64 = {
    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
        input = Base64._utf8_encode(input);
        while (i < input.length) {
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);
            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;
            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }
            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
        }
        return output;
    },
    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
        while (i < input.length) {
            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));
            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;
            output = output + String.fromCharCode(chr1);
            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }
        }
        output = Base64._utf8_decode(output);
        return output;
    },
    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";
        for (var n = 0; n < string.length; n++) {
            var c = string.charCodeAt(n);
            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
        }
        return utftext;
    },
    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;
        while ( i < utftext.length ) {
            c = utftext.charCodeAt(i);
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }
        return string;
    }
}
var args=WScript.Arguments;
input=args.Item(0).substring(9,args.Item(0).length-1);
//WScript.Echo(input);
//WScript.Echo(Base64.decode(input));
var shellapp = new ActiveXObject("Shell.Application");
shellapp.ShellExecute("D:\\Dev\\m3u8\\N_m3u8DL-RE.exe", Base64.decode(input), null, "runas", 1);

以上保存为bat文件,然后将这个bat注册为URL协议对象 bat将链接的密串 decode之后 透传m3u8DL-RE 启动

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\m3u8dl]
@="URL:m3u8DL Protocol"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\m3u8dl\DefaultIcon]
@="\"D:\\Dev\\m3u8\\N_m3u8DL-RE.exe\",1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\m3u8dl\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\m3u8dl\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\m3u8dl\shell\open\command]
@="\"D:\\Dev\\m3u8\\N_m3u8DL-RE.bat\" \"%1\""

D:\\Dev\\m3u8\\N_m3u8DL-RE.bat 替换成自己的路径

参见说明 https://github.com/nilaoda/N_m3u8DL-RE/issues/163#issuecomment-1536282352