code:
import './lib/util.js';
import cheerio from 'assets://js/lib/cheerio.min.js';
import 'assets://js/lib/crypto-js.js'
// import muban from 'https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/模板.js';

// const key = 'drpy_zbk';
// eval(req('http://192.168.1.124:5705/libs/es6py.js').content);
function init_test() {
    console.log("init_test_start");
    console.log(RKEY);
    console.log(JSON.stringify(rule));
    // clearItem(RULE_CK);
    // console.log(JSON.stringify(rule));
    // let aa = base64Encode('编码测试一下')
    // log(aa);
    // let bb = base64Decode(aa);
    // log('bb:' + bb);
    // console.log(request('https://www.baidu.com',{withHeaders:true}));
    // console.log(request('https://www.baidu.com/favicon.ico', { toBase64: true }));
    // require('http://192.168.10.99:5705/txt/pluto/drT.js');
    // console.log(typeof(drT));
    // console.log(drT.renderText('{{fl.cate}},hi, {{fl}}哈哈.{{fl}}',{sort: 1,cate:'movie'},'fl'));
    console.log("init_test_end");
}

let rule = {};
/** 已知问题记录
 * 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染
 * Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来
 * 2.import es6py.js但是里面的函数没有被装载进来.比如drpy规则报错setResult2 is undefiend
 * 3.无法重复导入cheerio(怎么解决drpy和parseTag里都需要导入cheerio的问题) 无法在副文件导入cheerio (现在是全部放在drpy一个文件里了,凑合解决?)
 * 4.有个错误不知道哪儿来的 executeScript: com.quickjs.JSObject$Undefined cannot be cast to java.lang.String 在 点击选集播放打印init_test_end后面打印
 * 5.需要实现 stringify 函数,比起JSON.stringify函数,它会原封不动保留中文不会编码unicode
 * todo:  jsp:{pdfa,pdfh,pd},json:{pdfa,pdfh,pd},jq:{pdfa,pdfh,pd}
 *  * 电脑看日志调试
 adb tcpip 5555
 adb connect 192.168.10.192
 adb devices -l
 adb logcat -c
 adb logcat | grep -i QuickJS
 * **/

/*** 以下是内置变量和解析方法 **/
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
const PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36';
const UA = 'Mozilla/5.0';
const UC_UA = 'Mozilla/5.0 (Linux; U; Android 9; zh-CN; MI 9 Build/PKQ1.181121.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.5.5.1035 Mobile Safari/537.36';
const IOS_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
const RULE_CK = 'cookie'; // 源cookie的key值
// const KEY = typeof(key)!=='undefined'&&key?key:'drpy_' + (rule.title || rule.host); // 源的唯一标识
const CATE_EXCLUDE = '首页|留言|APP|下载|资讯|新闻|动态';
const TAB_EXCLUDE = '猜你|喜欢|APP|下载|剧情|热播';
const OCR_RETRY = 3;//ocr验证重试次数
// const OCR_API = 'http://dm.mudery.com:10000';//ocr在线识别接口
// const OCR_API = 'http://192.168.3.239:5705/parse/ocr';//ocr在线识别接口
const OCR_API = 'http://cms.nokia.press/parse/ocr';//ocr在线识别接口
if (typeof (MY_URL) === 'undefined') {
    var MY_URL; // 全局注入变量,pd函数需要
}
var RKEY; // 源的唯一标识
var fetch;
var print;
var log;
var rule_fetch_params;
var fetch_params; // 每个位置单独的
var oheaders;
var _pdfh;
var _pdfa;
var _pd;
// const DOM_CHECK_ATTR = ['url', 'src', 'href', 'data-original', 'data-src'];
const DOM_CHECK_ATTR = /(url|src|href|data-original|data-src)$/;
const SELECT_REGEX = /:eq|:lt|:gt|#/g;
const SELECT_REGEX_A = /:eq|:lt|:gt/g;

function setResult(d) {
    if (!Array.isArray(d)) {
        return []
    }
    VODS = [];
    // print(d);
    d.forEach(function (it) {
        let obj = {
            vod_id: it.url || '',
            vod_name: it.title || '',
            vod_remarks: it.desc || '',
            vod_content: it.content || '',
            vod_pic: it.pic_url || it.img || '',
        };
        let keys = Object.keys(it);
        if (keys.includes('tname')) {
            obj.type_name = it.tname || '';
        }
        if (keys.includes('tid')) {
            obj.type_id = it.tid || '';
        }
        if (keys.includes('year')) {
            obj.vod_year = it.year || '';
        }
        if (keys.includes('actor')) {
            obj.vod_actor = it.actor || '';
        }
        if (keys.includes('director')) {
            obj.vod_director = it.director || '';
        }
        if (keys.includes('area')) {
            obj.vod_area = it.area || '';
        }
        VODS.push(obj);
    });
    return VODS
}
function setResult2(res) {
    VODS = res.list || [];
    return VODS
}
function setHomeResult(res) {
    if (!res || typeof (res) !== 'object') {
        return []
    }
    return setResult(res.list);
}
// 猫了个咪
function rc(js) {
    if (js === 'maomi_aes.js') {
        var a = CryptoJS.enc.Utf8.parse("625222f9149e961d");
        var t = CryptoJS.enc.Utf8.parse("5efdtf6060e2o330");
        return {
            De: function (word) {
                word = CryptoJS.enc.Hex.parse(word)
                return CryptoJS.AES.decrypt(CryptoJS.enc.Base64.stringify(word), a, {
                    iv: t,
                    mode: CryptoJS.mode.CBC,
                    padding: CryptoJS.pad.Pkcs7
                }).toString(CryptoJS.enc.Utf8)
            },
            En: function (word) {
                // print(a);
                // print(word);
                var Encrypted = CryptoJS.AES.encrypt(word, a, {
                    iv: t,
                    mode: CryptoJS.mode.CBC,
                    padding: CryptoJS.pad.Pkcs7
                });
                return Encrypted.ciphertext.toString();
            }
        };
    }
    return {};
}

// 千万不要用for in 推荐 forEach (for in 会打乱顺序)
//猫函数
function maoss(jxurl, ref, key) {
    eval(getCryptoJS());
    try {
        var getVideoInfo = function (text) {
            return CryptoJS.AES.decrypt(text, key, { iv: iv, padding: CryptoJS.pad.Pkcs7 }).toString(CryptoJS.enc.Utf8);
        };
        var token_key = key == undefined ? 'dvyYRQlnPRCMdQSe' : key;
        if (ref) {
            var html = request(jxurl, {
                headers: {
                    'Referer': ref
                }
            });
        } else {
            var html = request(jxurl);
        }
        // print(html);
        if (html.indexOf('&btwaf=') != -1) {
            html = request(jxurl + '&btwaf' + html.match(/&btwaf(.*?)"/)[1], {
                headers: {
                    'Referer': ref
                }
            })
        }
        var token_iv = html.split('_token = "')[1].split('"')[0];
        var key = CryptoJS.enc.Utf8.parse(token_key);
        var iv = CryptoJS.enc.Utf8.parse(token_iv);
        // log("iv:"+iv);
        //  log(html);
        // print(key);
        // print(iv);
        eval(html.match(/var config = {[\s\S]*?}/)[0] + '');
        // config.url = config.url.replace(/,/g,'');
        // print(config.url);
        if (!config.url.startsWith('http')) {
            //config.url = decodeURIComponent(AES(config.url, key, iv));
            config.url = CryptoJS.AES.decrypt(config.url, key, {
                iv: iv,
                padding: CryptoJS.pad.Pkcs7
            }).toString(CryptoJS.enc.Utf8)
        }
        return config.url;
    } catch (e) {
        return '';
    }
}

let VODS = [];// 一级或者搜索需要的数据列表
let VOD = {};// 二级的单个数据

/**
 * 重写pd方法-增加自动urljoin(没法重写,改个名继续骗)
 * @param html
 * @param parse
 * @param uri
 * @returns {*}
 */
function pD(html, parse, uri) {
    let ret = pdfh(html, parse);
    if (typeof (uri) === 'undefined' || !uri) {
        uri = '';
    }
    if (DOM_CHECK_ATTR.test(parse)) {
        if (/http/.test(ret)) {
            ret = ret.substr(ret.indexOf('http'));
        } else {
            ret = urljoin(MY_URL, ret)
        }
    }
    // MY_URL = getItem('MY_URL',MY_URL);
    // console.log(`规则${RKEY}打印MY_URL:${MY_URL},uri:${uri}`);
    return ret
}

const parseTags = {
    jsp: {
        pdfh: pdfh,
        pdfa: pdfa,
        pd: pD,
    },
    json: {
        pdfh(html, parse) {
            if (!parse || !parse.trim()) {
                return '';
            }
            if (typeof (html) === 'string') {
                html = JSON.parse(html);
            }
            parse = parse.trim();
            if (!parse.startsWith('$.')) {
                parse = '$.' + parse;
            }
            parse = parse.split('||');
            for (let ps of parse) {
                let ret = cheerio.jp(ps, html);
                if (Array.isArray(ret)) {
                    ret = ret[0] || '';
                } else {
                    ret = ret || ''
                }
                if (ret && typeof (ret) !== 'string') {
                    ret = ret.toString();
                }
                if (ret) {
                    return ret
                }
            }
            return '';
        },
        pdfa(html, parse) {
            if (!parse || !parse.trim()) {
                return '';
            }
            if (typeof (html) === 'string') {
                html = JSON.parse(html);
            }
            parse = parse.trim()
            if (!parse.startsWith('$.')) {
                parse = '$.' + parse;
            }
            let ret = cheerio.jp(parse, html);
            if (Array.isArray(ret) && Array.isArray(ret[0]) && ret.length === 1) {
                return ret[0] || []
            }
            return ret || []
        },
        pd(html, parse) {
            let ret = parseTags.json.pdfh(html, parse);
            if (ret) {
                return urljoin(MY_URL, ret);
            }
            return ret
        },
    },
    jq: {
        pdfh: pdfh,
        pdfa: pdfa,
        pd(html, parse, uri) {
            return parseTags.jq.pdfh(html, parse, MY_URL);
        },
    },
    getParse(p0) {//非js开头的情况自动获取解析标签
        if (p0.startsWith('jsp:')) {
            return this.jsp
        } else if (p0.startsWith('json:')) {
            return this.json
        } else if (p0.startsWith('jq:')) {
            return this.jq
        } else {
            return this.jq
        }
    }
};

const stringify = JSON.stringify;
const jsp = parseTags.jsp;

/*** 后台需要实现的java方法并注入到js中 ***/

/**
 * 读取本地文件->应用程序目录
 * @param filePath
 * @returns {string}
 */
function readFile(filePath) {
    filePath = filePath || './uri.min.js';
    var fd = os.open(filePath);
    var buffer = new ArrayBuffer(1024);
    var len = os.read(fd, buffer, 0, 1024);
    console.log(len);
    let text = String.fromCharCode.apply(null, new Uint8Array(buffer));
    console.log(text);
    return text
}

/**
 * 处理返回的json数据
 * @param html
 * @returns {*}
 */
function dealJson(html) {
    try {
        return html.match(/[\w|\W|\s|\S]*?(\{[\w|\W|\s|\S]*\})/).group[1];
    } catch (e) {
    }
    try {
        html = JSON.parse(html);
    } catch (e) { }
    // console.log(typeof(html));
    return html;
}

/**
 * 验证码识别逻辑,需要java实现(js没有bytes类型,无法调用后端的传递图片二进制获取验证码文本的接口)
 * @type {{api: string, classification: (function(*=): string)}}
 */
var OcrApi = {
    api: OCR_API,
    classification: function (img) { // img是byte类型,这里不方便搞啊
        let code = '';
        try {
            let html = request(this.api, { data: { img: img }, headers: { 'User-Agent': PC_UA }, 'method': 'POST' });
            html = JSON.parse(html);
            code = html.url || '';
        } catch (e) { }
        return code
    }
};
/**
 * 验证码识别,暂未实现
 * @param url 验证码图片链接
 * @returns {string} 验证成功后的cookie
 */
function verifyCode(url) {
    let cnt = 0;
    let host = getHome(url);
    let cookie = '';
    while (cnt < OCR_RETRY) {
        try {
            // let obj = {headers:headers,timeout:timeout};
            let yzm_url = `${host}/index.php/verify/index.html`;
            console.log(`验证码链接:${yzm_url}`);
            let hhtml = request(yzm_url, { withHeaders: true, toBase64: true });
            let json = JSON.parse(hhtml);
            if (!cookie) {
                cookie = json['set-cookie'] ? json['set-cookie'].split(';')[0] : '';
            }
            // console.log(hhtml);
            console.log('cookie:' + cookie);
            let img = json.body;
            // console.log(img);
            let code = OcrApi.classification(img);
            console.log(`第${cnt + 1}次验证码识别结果:${code}`);
            let submit_url = `${host}/index.php/ajax/verify_check?type=search&verify=${code}`;
            console.log(submit_url);
            let html = request(submit_url, { headers: { Cookie: cookie, 'User-Agent': MOBILE_UA }, 'method': 'POST' });
            // console.log(html);
            html = JSON.parse(html);
            if (html.msg === 'ok') {
                console.log(`第${cnt + 1}次验证码提交成功`);
                return cookie // 需要返回cookie
            } else if (html.msg !== 'ok' && cnt + 1 >= OCR_RETRY) {
                cookie = ''; // 需要清空返回cookie
            }
        } catch (e) {
            console.log(`第${cnt + 1}次验证码提交失败:${e.message}`);
            if (cnt + 1 >= OCR_RETRY) {
                cookie = '';
            }
        }
        cnt += 1
    }
    return cookie
}

/**
 * 存在数据库配置表里, key字段对应值value,没有就新增,有就更新,调用此方法会清除key对应的内存缓存
 * @param k 键
 * @param v 值
 */
function setItem(k, v) {
    local.set(RKEY, k, v);
    console.log(`规则${RKEY}设置${k} => ${v}`)
}

/**
 *  获取数据库配置表对应的key字段的value，没有这个key就返回value默认传参.需要有缓存,第一次获取后会存在内存里
 * @param k 键
 * @param v 值
 * @returns {*}
 */
function getItem(k, v) {
    return local.get(RKEY, k) || v;
}

/**
 *  删除数据库key对应的一条数据,并清除此key对应的内存缓存
 * @param k
 */
function clearItem(k) {
    local.delete(RKEY, k);
}

/*** js自封装的方法 ***/

/**
 * 获取链接的host(带http协议的完整链接)
 * @param url 任意一个正常完整的Url,自动提取根
 * @returns {string}
 */
function getHome(url) {
    if (!url) {
        return ''
    }
    let tmp = url.split('//');
    url = tmp[0] + '//' + tmp[1].split('/')[0];
    try {
        url = decodeURIComponent(url);
    } catch (e) { }
    return url
}

/**
 * get参数编译链接,类似python params字典自动拼接
 * @param url 访问链接
 * @param obj 参数字典
 * @returns {*}
 */
function buildUrl(url, obj) {
    obj = obj || {};
    if (url.indexOf('?') < 0) {
        url += '?'
    }
    let param_list = [];
    let keys = Object.keys(obj);
    keys.forEach(it => {
        param_list.push(it + '=' + obj[it])
    });
    let prs = param_list.join('&');
    if (keys.length > 0 && !url.endsWith('?')) {
        url += '&'
    }
    url += prs;
    return url
}

/**
 * 远程依赖执行函数
 * @param url 远程js地址
 */
function require(url) {
    eval(request(url));
}
/**
 * 海阔网页请求函数完整封装
 * @param url 请求链接
 * @param obj 请求对象 {headers:{},method:'',timeout:5000,body:'',withHeaders:false}
 * @returns {string|string|DocumentFragment|*}
 */
function request(url, obj) {
    if (typeof (obj) === 'undefined' || !obj || obj === {}) {
        if (!fetch_params || !fetch_params.headers) {
            let headers = {
                'User-Agent': MOBILE_UA,
            };
            if (rule.headers) {
                Object.assign(headers, rule.headers);
            }
            fetch_params.headers = headers;
        }
        if (!fetch_params.headers.Referer) {
            fetch_params.headers.Referer = getHome(url)
        }
        obj = fetch_params;
    } else {
        let headers = obj.headers || {};
        let keys = Object.keys(headers).map(it => it.toLowerCase());
        if (!keys.includes('user-agent')) {
            headers['User-Agent'] = MOBILE_UA;
        } if (!keys.includes('referer')) {
            headers['Referer'] = getHome(url);
        }
        obj.headers = headers;
    }
    console.log(JSON.stringify(obj.headers));
    if (typeof (obj.headers.body) != 'undefined' && obj.headers.body && typeof (obj.headers.body) === 'string') {
        let data = {};
        obj.headers.body.split('&').forEach(it => {
            data[it.split('=')[0]] = it.split('=')[1]
        });
        obj.data = data;
        delete obj.headers.body
    }
    if (!url) {
        return obj.withHeaders ? '{}' : ''
    }
    if (obj.toBase64) { // 返回base64,用于请求图片
        obj.buffer = 2;
        delete obj.toBase64
    }
    console.log('request:' + url);
    let res = req(url, obj);
    let html = res.content || '';
    // console.log(html);
    if (obj.withHeaders) {
        let htmlWithHeaders = res.headers;
        htmlWithHeaders.body = html;
        return JSON.stringify(htmlWithHeaders);
    } else {
        return html
    }
}

fetch = request;
print = function (data) {
    data = data || '';
    if (typeof (data) !== 'string') {
        try {
            data = JSON.stringify(data);
        } catch (e) {
            console.log('print:' + e.message)
        }
    }
    console.log(data);
}
log = console.log;
/**
 * 检查宝塔验证并自动跳过获取正确源码
 * @param html 之前获取的html
 * @param url 之前的来源url
 * @param obj 来源obj
 * @returns {string|DocumentFragment|*}
 */
function checkHtml(html, url, obj) {
    if (/\?btwaf=/.test(html)) {
        let btwaf = html.match(/btwaf(.*?)"/)[1];
        url = url.split('#')[0] + '?btwaf' + btwaf;
        html = request(url, obj);
    }
    return html
}

/**
 *  带一次宝塔验证的源码获取
 * @param url 请求链接
 * @param obj 请求参数
 * @returns {string|DocumentFragment}
 */
function getCode(url, obj) {
    let html = request(url, obj);
    html = checkHtml(html, url, obj);
    return html
}

/**
 * 源rule专用的请求方法,自动注入cookie
 * @param url 请求链接
 * @returns {string|DocumentFragment}
 */
function getHtml(url) {
    let obj = {};
    if (rule.headers) {
        obj.headers = rule.headers;
    }
    let cookie = getItem(RULE_CK, '');
    if (cookie) {
        if (obj.headers && !Object.keys(obj.headers).map(it => it.toLowerCase()).includes('cookie')) {
            obj.headers['Cookie'] = cookie;
        } else if (!obj.headers) {
            obj.headers = { Cookie: cookie };
        }
    }
    let html = getCode(url, obj);
    return html
}

/**
 * 首页分类解析，筛选暂未实现
 * @param homeObj 首页传参对象
 * @returns {string}
 */
function homeParse(homeObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    let classes = [];
    if (homeObj.class_name && homeObj.class_url) {
        let names = homeObj.class_name.split('&');
        let urls = homeObj.class_url.split('&');
        let cnt = Math.min(names.length, urls.length);
        for (let i = 0; i < cnt; i++) {
            classes.push({
                'type_id': urls[i],
                'type_name': names[i]
            });
        }
    }

    if (homeObj.class_parse) {
        let p = homeObj.class_parse.split(';');
        if (p.length >= 4) {
            try {
                let html = getHtml(homeObj.MY_URL);
                if (html) {
                    homeHtmlCache = html;
                    let list = pdfa(html, p[0]);
                    if (list && list.length > 0) {
                        list.forEach((it, idex) => {
                            try {
                                let name = pdfh(it, p[1]);
                                if (homeObj.cate_exclude && (new RegExp(homeObj.cate_exclude).test(name))) {
                                    return;
                                }
                                let url = pdfh(it, p[2]);
                                if (p[3]) {
                                    let exp = new RegExp(p[3]);
                                    url = url.match(exp)[1];
                                }

                                classes.push({
                                    'type_id': url.trim(),
                                    'type_name': name.trim()
                                });
                            } catch (e) {
                                console.log(`分类列表定位第${idex}个元素正常报错:${e.message}`);
                            }
                        });
                    }
                }
            } catch (e) {
                console.log(e.message);
            }

        }
    }
    // 排除分类
    classes = classes.filter(it => !homeObj.cate_exclude || !(new RegExp(homeObj.cate_exclude).test(it.type_name)));
    let resp = {
        'class': classes
    };
    if (homeObj.filter) {
        resp.filters = homeObj.filter;
    }
    console.log(JSON.stringify(resp));
    return JSON.stringify(resp);

}

/**
 *  首页推荐列表解析
 * @param homeVodObj
 * @returns {string}
 */
function homeVodParse(homeVodObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    let d = [];
    MY_URL = homeVodObj.homeUrl;
    // setItem('MY_URL',MY_URL);
    console.log(MY_URL);
    let p = homeVodObj.推荐;
    if (!p || typeof (p) !== 'string') {
        return '{}'
    }
    p = p.trim();
    if (p.startsWith('js:')) {
        const TYPE = 'home';
        var input = MY_URL;
        const HOST = rule.host;
        eval(p.replace('js:', ''));
        d = VODS;
    } else {
        p = p.split(';');
        if (!homeVodObj.double && p.length < 5) {
            return '{}'
        } else if (homeVodObj.double && p.length < 6) {
            return '{}'
        }
        let _ps = parseTags.getParse(p[0]);
        _pdfa = _ps.pdfa;
        _pdfh = _ps.pdfh;
        _pd = _ps.pd;
        let is_json = p[0].startsWith('json:');
        p[0] = p[0].replace(/^(jsp:|json:|jq:)/, '');
        // print(p[0]);
        let html = homeHtmlCache || getHtml(MY_URL);
        homeHtmlCache = undefined;
        if (is_json) {
            html = dealJson(html);
        }
        try {
            console.log('double:' + homeVodObj.double);
            if (homeVodObj.double) {
                let items = _pdfa(html, p[0]);
                // console.log(items.length);
                for (let item of items) {
                    // console.log(p[1]);
                    let items2 = _pdfa(item, p[1]);
                    // console.log(items2.length);
                    for (let item2 of items2) {
                        try {
                            let title = _pdfh(item2, p[2]);
                            let img = '';
                            try {
                                img = _pd(item2, p[3])
                            } catch (e) {
                            }
                            let desc = _pdfh(item2, p[4]);
                            let links = [];
                            for (let p5 of p[5].split('+')) {
                                let link = !homeVodObj.detailUrl ? _pd(item2, p5, MY_URL) : _pdfh(item2, p5);
                                links.push(link);
                            }
                            let vod = {
                                vod_name: title,
                                vod_pic: img,
                                vod_remarks: desc,
                                vod_id: links.join('$')
                            };
                            // print(vod);
                            d.push(vod);
                        } catch (e) {
                            console.log('首页列表处理发生错误:' + e.message);
                        }

                    }
                }
            } else {
                let items = _pdfa(html, p[0]);
                for (let item of items) {
                    try {
                        let title = _pdfh(item, p[1]);
                        let img = '';
                        try {
                            img = _pd(item, p[2], MY_URL);
                        } catch (e) {

                        }
                        let desc = _pdfh(item, p[3]);
                        let links = [];
                        for (let p5 of p[4].split('+')) {
                            let link = !homeVodObj.detailUrl ? _pd(item, p5, MY_URL) : _pdfh(item, p5);
                            links.push(link);
                        }
                        let vod = {
                            vod_name: title,
                            vod_pic: img,
                            vod_remarks: desc,
                            vod_id: links.join('$')
                        };
                        d.push(vod);

                    } catch (e) {

                    }

                }

            }

        } catch (e) {

        }
    }
    // console.log(JSON.stringify(d));
    return JSON.stringify({
        list: d
    })
}

/**
 * 一级分类页数据解析
 * @param cateObj
 * @returns {string}
 */
function categoryParse(cateObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    let p = cateObj.一级;
    if (!p || typeof (p) !== 'string') {
        return '{}'
    }
    let d = [];
    // let url = cateObj.url.replaceAll('fyclass', cateObj.tid).replaceAll('fypage', cateObj.pg);
    let url = cateObj.url.replaceAll('fyclass', cateObj.tid);
    if (rule.filter_url) {
        if (!/fyfilter/.test(url)) {
            if (!url.endsWith('&') && !rule.filter_url.startsWith('&')) {
                url += '&'
            }
            url += rule.filter_url;
        } else {
            url = url.replace('fyfilter', rule.filter_url);
        }
        // console.log('filter:'+cateObj.filter);
        let fl = cateObj.filter ? cateObj.extend : {};
        let new_url;
        new_url = cheerio.jinja2(url, { fl: fl });
        // if (/object Object/.test(new_url)) {
        //     new_url = drT.renderText(url, fl);
        // }
        url = new_url;
    }
    if (/fypage/.test(url)) {
        if (url.includes('(') && url.includes(')')) {
            let url_rep = url.match(/.*?\((.*)\)/)[1];
            // console.log(url_rep);
            let cnt_page = url_rep.replaceAll('fypage', cateObj.pg);
            // console.log(cnt_page);
            let cnt_pg = eval(cnt_page);
            // console.log(cnt_pg);
            url = url.replaceAll(url_rep, cnt_pg).replaceAll('(', '').replaceAll(')', '');
        } else {
            url = url.replaceAll('fypage', cateObj.pg);
        }
    }
    if (cateObj.pg === 1 && url.includes('[') && url.includes(']')) {
        url = url.split('[')[1].split(']')[0];
    }
    MY_URL = url;
    // setItem('MY_URL',MY_URL);
    console.log(MY_URL);
    p = p.trim();
    const MY_CATE = cateObj.tid;
    if (p.startsWith('js:')) {
        var MY_FL = cateObj.extend;
        const TYPE = 'cate';
        var input = MY_URL;
        const MY_PAGE = cateObj.pg;
        var desc = '';
        eval(p.trim().replace('js:', ''));
        d = VODS;
    } else {
        p = p.split(';');
        if (p.length < 5) {
            return '{}'
        }
        let _ps = parseTags.getParse(p[0]);
        _pdfa = _ps.pdfa;
        _pdfh = _ps.pdfh;
        _pd = _ps.pd;
        let is_json = p[0].startsWith('json:');
        p[0] = p[0].replace(/^(jsp:|json:|jq:)/, '');
        try {
            let html = getHtml(MY_URL);
            if (html) {
                if (is_json) {
                    html = dealJson(html);
                }
                let list = _pdfa(html, p[0]);
                list.forEach(it => {
                    let links = p[4].split('+').map(p4 => {
                        return !rule.detailUrl ? _pd(it, p4, MY_URL) : _pdfh(it, p4);
                    });
                    let link = links.join('$');
                    let vod_id = rule.detailUrl ? MY_CATE + '$' + link : link;
                    d.push({
                        'vod_id': vod_id,
                        'vod_name': _pdfh(it, p[1]).replace(/\n|\t/g, '').trim(),
                        'vod_pic': _pd(it, p[2], MY_URL),
                        'vod_remarks': _pdfh(it, p[3]).replace(/\n|\t/g, '').trim(),
                    });
                });
            }
        } catch (e) {
            console.log(e.message);
        }
    }
    // print(d);
    return d.length < 1 ? '{}' : JSON.stringify({
        'page': parseInt(cateObj.pg),
        'pagecount': 999,
        'limit': 20,
        'total': 999,
        'list': d,
    });
}

/**
 * 搜索列表数据解析
 * @param searchObj
 * @returns {string}
 */
function searchParse(searchObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    let d = [];
    if (!searchObj.searchUrl) {
        return '{}'
    }
    let p = searchObj.搜索 === '*' && rule.一级 ? rule.一级 : searchObj.搜索;
    if (!p || typeof (p) !== 'string') {
        return '{}'
    }
    p = p.trim();
    let url = searchObj.searchUrl.replaceAll('**', searchObj.wd).replaceAll('fypage', searchObj.pg);
    MY_URL = url;
    console.log(MY_URL);
    // setItem('MY_URL',MY_URL);
    if (p.startsWith('js:')) {
        const TYPE = 'search';
        const MY_PAGE = searchObj.pg;
        const KEY = searchObj.wd;
        var input = MY_URL;
        var detailUrl = rule.detailUrl || '';
        eval(p.trim().replace('js:', ''));
        d = VODS;
    } else {
        p = p.split(';');
        if (p.length < 5) {
            return '{}'
        }
        let _ps = parseTags.getParse(p[0]);
        _pdfa = _ps.pdfa;
        _pdfh = _ps.pdfh;
        _pd = _ps.pd;
        let is_json = p[0].startsWith('json:');
        p[0] = p[0].replace(/^(jsp:|json:|jq:)/, '');
        try {
            let html = getHtml(MY_URL);
            if (html) {
                if (/系统安全验证|输入验证码/.test(html)) {
                    let cookie = verifyCode(MY_URL);
                    if (cookie) {
                        console.log(`本次成功过验证,cookie:${cookie}`);
                        setItem(RULE_CK, cookie);
                    } else {
                        console.log(`本次自动过搜索验证失败,cookie:${cookie}`);
                    }
                    // obj.headers['Cookie'] = cookie;
                    html = getHtml(MY_URL);
                }
                if (!html.includes(searchObj.wd)) {
                    console.log('搜索结果源码未包含关键字,疑似搜索失败,正为您打印结果源码');
                    console.log(html);
                }
                if (is_json) {
                    html = dealJson(html);
                }
                let list = _pdfa(html, p[0]);
                list.forEach(it => {
                    let links = p[4].split('+').map(p4 => {
                        return !rule.detailUrl ? _pd(it, p4, MY_URL) : _pdfh(it, p4)
                    });

                    let link = links.join('$');
                    let ob = {
                        'vod_id': link,
                        'vod_name': _pdfh(it, p[1]).replace(/\n|\t/g, '').trim(),
                        'vod_pic': _pd(it, p[2], MY_URL),
                        'vod_remarks': _pdfh(it, p[3]).replace(/\n|\t/g, '').trim(),
                    };
                    if (p.length > 5 && p[5]) {
                        ob.vod_content = _pdfh(it, p[5]);
                    }
                    d.push(ob);
                });

            }
        } catch (e) {
            return '{}'
        }

    }
    return JSON.stringify({
        'page': parseInt(searchObj.pg),
        'pagecount': 10,
        'limit': 20,
        'total': 100,
        'list': d,
    });
}

/**
 * 二级详情页数据解析
 * @param detailObj
 * @returns {string}
 */
function detailParse(detailObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    let vod = {
        vod_id: detailObj.orId, //"id",
        vod_name: "片名",
        vod_pic: "",
        type_name: "剧情",
        vod_year: "年份",
        vod_area: "地区",
        vod_remarks: "更新信息",
        vod_actor: "主演",
        vod_director: "导演",
        vod_content: "简介"
    };
    let p = detailObj.二级;
    let url = detailObj.url;
    let detailUrl = detailObj.detailUrl;
    let fyclass = detailObj.fyclass;
    let tab_exclude = detailObj.tab_exclude;
    let html = detailObj.html || '';
    MY_URL = url;
    console.log(MY_URL);
    // setItem('MY_URL',MY_URL);
    if (p === '*') {
        vod.vod_play_from = '道长在线';
        vod.vod_remarks = detailUrl;
        vod.vod_actor = '没有二级,只有一级链接直接嗅探播放';
        vod.vod_content = MY_URL;
        vod.vod_play_url = '嗅探播放$' + MY_URL;
    } else if (typeof (p) === 'string' && p.trim().startsWith('js:')) {
        const TYPE = 'detail';
        var input = MY_URL;
        eval(p.trim().replace('js:', ''));
        vod = VOD;
        console.log(JSON.stringify(vod));
    } else if (p && typeof (p) === 'object') {
        if (!html) {
            html = getHtml(MY_URL);
        }
        let _impJQP = true;
        let _ps;
        if (p.is_json) {
            _ps = parseTags.json;
            html = dealJson(html);
            _impJQP = false;
        } else if (p.is_jsp) {
            _ps = parseTags.jsp;
        } else if (p.is_jq) {
            _ps = parseTags.jq;
        } else {
            _ps = parseTags.jq;
        }
        if (_impJQP) {
            let c$ = cheerio.load(html);
            html = { rr: c$, ele: c$('html')[0] }
        }
        _pdfa = _ps.pdfa;
        _pdfh = _ps.pdfh;
        _pd = _ps.pd;
        if (p.title) {
            let p1 = p.title.split(';');
            vod.vod_name = _pdfh(html, p1[0]).replace(/\n|\t/g, '').trim();
            let type_name = p1.length > 1 ? _pdfh(html, p1[1]).replace(/\n|\t/g, '').replace(/ /g, '').trim() : '';
            vod.type_name = type_name || vod.type_name;
        }
        if (p.desc) {
            try {
                let p1 = p.desc.split(';');
                vod.vod_remarks = _pdfh(html, p1[0]).replace(/\n|\t/g, '').trim();
                vod.vod_year = p1.length > 1 ? _pdfh(html, p1[1]).replace(/\n|\t/g, '').trim() : '';
                vod.vod_area = p1.length > 2 ? _pdfh(html, p1[2]).replace(/\n|\t/g, '').trim() : '';
                // vod.vod_actor = p1.length > 3 ? _pdfh(html, p1[3]).replaceAll('\n', ' ').trim():'';
                vod.vod_actor = p1.length > 3 ? _pdfh(html, p1[3]).replace(/\n|\t/g, '').trim() : '';
                vod.vod_director = p1.length > 4 ? _pdfh(html, p1[4]).replace(/\n|\t/g, '').trim() : '';
            }
            catch (e) {

            }
        }
        if (p.content) {
            try {
                let p1 = p.content.split(';');
                vod.vod_content = _pdfh(html, p1[0]).replace(/\n|\t/g, '').trim();
            }
            catch (e) { }
        }
        if (p.img) {
            try {
                let p1 = p.img.split(';');
                vod.vod_pic = _pd(html, p1[0], MY_URL);
            }
            catch (e) { }
        }

        let vod_play_from = '$$$';
        let playFrom = [];
        if (p.重定向 && p.重定向.startsWith('js:')) {
            html = eval(p.重定向.replace('js:', ''));
            if (_impJQP) {
                let c$ = cheerio.load(html);
                html = { rr: c$, ele: c$('html')[0] }
            }
        }

        // console.log(2);
        if (p.tabs) {
            let p_tab = p.tabs.split(';')[0];
            console.log(p_tab);
            let vHeader = _pdfa(html, p_tab);

            console.log(vHeader.length);
            for (let v of vHeader) {
                let v_title = _pdfh(v, 'body&&Text');
                console.log(v_title);
                if (tab_exclude && (new RegExp(tab_exclude)).test(v_title)) {
                    continue;
                }
                playFrom.push(v_title);
            }
            console.log(JSON.stringify(playFrom));
        } else {
            playFrom = ['道长在线']
        }
        vod.vod_play_from = playFrom.join(vod_play_from);

        // console.log(3);
        let vod_play_url = '$$$';
        let vod_tab_list = [];
        if (p.lists) {
            for (let i = 0; i < playFrom.length; i++) {
                let tab_name = playFrom[i];
                let tab_ext = p.tabs.split(';').length > 1 ? p.tabs.split(';')[1] : '';
                let p1 = p.lists.replaceAll('#idv', tab_name).replaceAll('#id', i);
                tab_ext = tab_ext.replaceAll('#idv', tab_name).replaceAll('#id', i);
                console.log(p1);
                // console.log(html);
                let vodList = [];
                try {
                    vodList = _pdfa(html, p1);
                    console.log('len(vodList):' + vodList.length);
                } catch (e) {
                    // console.log(e.message);
                }
                let new_vod_list = [];
                let tabName = tab_ext ? _pdfh(html, tab_ext) : tab_name;
                console.log(tabName);
                // console.log('cheerio解析Text');
                vodList.forEach(it => {
                    // 请注意,这里要固定pdfh解析body&&Text,不需要下划线,没写错
                    // new_vod_list.push(pdfh(it,'body&&Text')+'$'+_pd(it,'a&&href',MY_URL));
                    // new_vod_list.push(cheerio.load(it).text() + '$' + _pd(it, 'a&&href', MY_URL));
                    new_vod_list.push(_pdfh(it, 'body&&Text') + '$' + _pd(it, 'a&&href', MY_URL));
                });
                let vlist = new_vod_list.join('#');
                vod_tab_list.push(vlist);
            }
        }
        vod.vod_play_url = vod_tab_list.join(vod_play_url);
    }
    // print(vod);
    return JSON.stringify({
        list: [vod]
    })
}

/**
 * 选集播放点击事件解析
 * @param playObj
 * @returns {string}
 */
function playParse(playObj) {
    fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
    MY_URL = playObj.url;
    if (!/http/.test(MY_URL)) {
        try {
            MY_URL = base64Decode(MY_URL);
        } catch (e) { }
    }
    MY_URL = decodeURIComponent(MY_URL);
    var input = MY_URL;//注入给免嗅js
    let common_play = {
        parse: 1,
        url: input
    };
    let lazy_play;
    if (!rule.play_parse || !rule.lazy) {
        lazy_play = common_play;
    } else if (rule.play_parse && rule.lazy && typeof (rule.lazy) === 'string') {
        try {
            let lazy_code = rule.lazy.replace('js:', '').trim();
            print('开始执行js免嗅=>' + lazy_code);
            eval(lazy_code);
            lazy_play = typeof (input) === 'object' ? input : {
                parse: 1,
                jx: 1,
                url: input
            };
        } catch (e) {
            print('js免嗅错误:' + e.message);
            lazy_play = common_play;
        }
    } else {
        lazy_play = common_play;
    }
    console.log(JSON.stringify(lazy_play));
    return JSON.stringify(lazy_play);
}

/**
 * js源预处理特定返回对象中的函数
 * @param ext
 */
function init(ext) {
    console.log('init');
    try {
        // make shared jsContext happy
        if (typeof (globalThis.mubanJs) === 'undefined') {
            let mubanJs = request('https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/模板.js', { 'User-Agent': MOBILE_UA });
            mubanJs = mubanJs.replace('export default', '(function() {return muban;}()) // export default');
            globalThis.mubanJs = mubanJs;
        }
        let muban = eval(globalThis.mubanJs);
        if (typeof ext == 'object') {
            rule = ext;
            if (rule.template) {
                rule = Object.assign(muban[rule.template], rule);
            }
        } else if (typeof ext == 'string') {
            if (ext.startsWith('http')) {
                let js = request(ext, { 'method': 'GET' });
                if (js) {
                    eval(js.replace('var rule', 'rule'));
                }
            }
        } else {
            eval(ext.replace('var rule', 'rule'));
        }
        /** 处理一下 rule规则关键字段没传递的情况 **/
        let rule_cate_excludes = (rule.cate_exclude || '').split('|').filter(it => it.trim());
        let rule_tab_excludes = (rule.tab_exclude || '').split('|').filter(it => it.trim());
        rule_cate_excludes = rule_cate_excludes.concat(CATE_EXCLUDE.split('|').filter(it => it.trim()));
        rule_tab_excludes = rule_tab_excludes.concat(TAB_EXCLUDE.split('|').filter(it => it.trim()));

        rule.cate_exclude = rule_cate_excludes.join('|');
        rule.tab_exclude = rule_tab_excludes.join('|');
        rule.host = (rule.host || '').rstrip('/');
        rule.url = rule.url || '';
        rule.double = rule.double || false;
        rule.homeUrl = rule.homeUrl || '';
        rule.detailUrl = rule.detailUrl || '';
        rule.searchUrl = rule.searchUrl || '';
        rule.homeUrl = rule.host && rule.homeUrl ? urljoin(rule.host, rule.homeUrl) : (rule.homeUrl || rule.host);
        rule.detailUrl = rule.host && rule.detailUrl ? urljoin(rule.host, rule.detailUrl) : rule.detailUrl;
        if (rule.url.includes('[') && rule.url.includes(']')) {
            let u1 = rule.url.split('[')[0]
            let u2 = rule.url.split('[')[1].split(']')[0]
            rule.url = rule.host && rule.url ? urljoin(rule.host, u1) + '[' + urljoin(rule.host, u2) + ']' : rule.url;
        } else {
            rule.url = rule.host && rule.url ? urljoin(rule.host, rule.url) : rule.url;
        }
        rule.searchUrl = rule.host && rule.searchUrl ? urljoin(rule.host, rule.searchUrl) : rule.searchUrl;

        rule.timeout = rule.timeout || 5000;
        rule.encoding = rule.编码 || rule.encoding || 'utf-8';
        if (rule.headers && typeof (rule.headers) === 'object') {
            try {
                let header_keys = Object.keys(rule.headers);
                for (let k of header_keys) {
                    if (k.toLowerCase() === 'user-agent') {
                        let v = rule.headers[k];
                        console.log(v);
                        if (['MOBILE_UA', 'PC_UA', 'UC_UA', 'IOS_UA', 'UA'].includes(v)) {
                            rule.headers[k] = eval(v);
                        }
                    }
                }
            } catch (e) {
                console.log('处理headers发生错误:' + e.message);
            }
        }
        // print(rule.headers);
        rule_fetch_params = { 'headers': rule.headers || false, 'timeout': rule.timeout, 'encoding': rule.encoding };
        oheaders = rule.headers || {};
        RKEY = typeof (key) !== 'undefined' && key ? key : 'drpy_' + (rule.title || rule.host);
        init_test();
    } catch (e) {
        console.log('init_test发生错误:' + e.message);
    }
}

let homeHtmlCache = undefined;

/**
 * js源获取首页分类和筛选特定返回对象中的函数
 * @param filter 筛选条件字典对象
 * @returns {string}
 */
function home(filter) {
    console.log("home");
    let homeObj = {
        filter: rule.filter || false,
        MY_URL: rule.homeUrl,
        class_name: rule.class_name || '',
        class_url: rule.class_url || '',
        class_parse: rule.class_parse || '',
        cate_exclude: rule.cate_exclude,
    };
    return homeParse(homeObj);
}

/**
 * js源获取首页推荐数据列表特定返回对象中的函数
 * @param params
 * @returns {string}
 */
function homeVod(params) {
    let homeVodObj = {
        推荐: rule.推荐,
        double: rule.double,
        homeUrl: rule.homeUrl,
        detailUrl: rule.detailUrl
    };
    return homeVodParse(homeVodObj)
    // return "{}";
}

/**
 * js源获取分类页一级数据列表特定返回对象中的函数
 * @param tid 分类id
 * @param pg 页数
 * @param filter 当前选中的筛选条件
 * @param extend 扩展
 * @returns {string}
 */
function category(tid, pg, filter, extend) {
    let cateObj = {
        url: rule.url,
        一级: rule.一级,
        tid: tid,
        pg: parseInt(pg),
        filter: filter,
        extend: extend
    };
    // console.log(JSON.stringify(extend));
    return categoryParse(cateObj)
}

/**
 * js源获取二级详情页数据特定返回对象中的函数
 * @param vod_url 一级列表中的vod_id或者是带分类的自拼接 vod_id 如 fyclass$vod_id
 * @returns {string}
 */
function detail(vod_url) {
    let orId = vod_url;
    let fyclass = '';
    if (vod_url.indexOf('$') > -1) {
        let tmp = vod_url.split('$');
        fyclass = tmp[0];
        vod_url = tmp[1];
    }
    let detailUrl = vod_url;
    let url;
    if (!detailUrl.startsWith('http') && !detailUrl.includes('/')) {
        url = rule.detailUrl.replaceAll('fyid', detailUrl).replaceAll('fyclass', fyclass);
    } else if (detailUrl.includes('/')) {
        url = urljoin(rule.homeUrl, detailUrl);
    } else {
        url = detailUrl
    }
    let detailObj = {
        orId: orId,
        url: url,
        二级: rule.二级,
        detailUrl: detailUrl,
        fyclass: fyclass,
        tab_exclude: rule.tab_exclude,
    }
    return detailParse(detailObj)
}

/**
 * js源选集按钮播放点击事件特定返回对象中的函数
 * @param flag 线路名
 * @param id 播放按钮的链接
 * @param flags 全局配置的flags是否需要解析的标识列表
 * @returns {string}
 */
function play(flag, id, flags) {
    let playObj = {
        url: id,
        flag: flag,
        flags: flags
    }
    return playParse(playObj);
}

/**
 * js源搜索返回的数据列表特定返回对象中的函数
 * @param wd 搜索关键字
 * @param quick 是否来自快速搜索
 * @returns {string}
 */
function search(wd, quick) {
    let searchObj = {
        searchUrl: rule.searchUrl,
        搜索: rule.搜索,
        wd: wd,
        //pg: pg,
        pg: 1,
        quick: quick,
    };
    // console.log(JSON.stringify(searchObj));
    return searchParse(searchObj)
}

function DRPY() {//导出函数
    return {
        init: init,
        home: home,
        homeVod: homeVod,
        category: category,
        detail: detail,
        play: play,
        search: search,
    }
}

let pd = pD;

// 导出函数对象
__JS_SPIDER__ = {
    init: init,
    home: home,
    homeVod: homeVod,
    category: category,
    detail: detail,
    play: play,
    search: search,
    DRPY: DRPY
}


code:
muban.首图2.二级.tabs = '.nav-tabs.dpplay&&li';
var rule = Object.assign(muban.首图2,{
    title:'007影视',
    host:'https://www.007ts.me',
    url:'/channel/fyclass-fypage.html',
    searchUrl:'/search/**----------fypage---.html',
});

license: unknown


code:
var rule = Object.assign(muban.mxpro,{
title:'1080P',
host:'https://1080p.tv',
url:'/vodshow/fyclass--------fypage---/',
searchUrl:'/vodsearch/**----------fypage---/',
class_parse:'.navbar-items li:gt(0):lt(5);a&&Text;a&&href;.*/(.*?)/',
});


code:
var rule = {
    title:'18av',
    host:'https://maa1812.com',
    url:'/zh/fyclass/all/fypage.html',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    class_name:'最近更新',//静态分类名称拼接
    class_url:'chinese_list',//静态分类标识拼接
   //class_parse:'ul.animenu__nav&&li;a&&Text;a&&href',
    limit:5,
    play_parse:true,
    lazy:'',
    一级:'.posts div;.meta&&Text;img&&src;.top&&Text;a&&href',
    二级:'*',

}


code:
var rule={
		title:'2099电影',
		host:'https://www.2099dy.com',
		url:'/index.php/vod/show/id/fyclass/page/fypage.html',
 		searchUrl:'/index.php/vod/search/page/fypage/wd/**.html',
		searchable:2,//是否启用全局搜索,
		quickSearch:0,//是否启用快速搜索,
		filterable:0,//是否启用分类筛选,
		//class_parse:'.nav-menu-items&&li;a&&Text;a&&href;.*/(.*?).html',
	        //cate_exclude:'演员',
	        class_name:'电影&电视剧&综艺&动漫&国产剧&香港剧&台湾剧&韩国剧&日本剧&欧美剧&海外剧',
                class_url:'1&2&3&4&13&14&15&16&20&21&22',
		play_parse:true,
		lazy:'',
		limit:6,
		推荐:'.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		double:true, // 推荐内容是否双层定位
		一级:'.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		二级:{"title":"h1&&Text;.tag-link&&Text","img":".module-item-pic&&img&&data-src","desc":".video-info-items:eq(-2)&&Text;.video-info-items:eq(-1)&&Text;.video-info-items:eq(-2)&&Text;.video-info-items:eq(1)&&.video-info-item&&Text;.video-info-items:eq(0)&&.video-info-item&&Text","content":".video-info-items:eq(6)&&.video-info-item&&Text","tabs":".module-tab-item","lists":".module-player-list:eq(#id)&&.scroll-content&&a"},
		搜索:'.module-items .module-search-item;h3&&Text;*;.video-serial&&Text;*',
}


code:
var rule = {
    title:'MV263',
    host:'https://www.mv263.com',
    url:'/fyclass_fypage.html',
    searchUrl:'/search.php?q=**',
    searchable:2,
    quickSearch:0,
    filterable:0,
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    class_parse: '.navbar li;a&&Text;a&&href;.*/(.*?).html',
    timeout:5000,
    play_parse:true,
    lazy:'js:let html=request(input);let src=jsp.pd(html,".edui-upload-video&&src");input={jx:0,url:src,parse:0,header:JSON.stringify({"referer":"https://www.mv263.com/"})}',
    limit:6,
    推荐:'.toplist&&li;*;*;p&&Text;a&&href',
    一级:'.article&&.post;.b-lazy&&alt;.b-lazy&&data-src;.post-text&&Text;a&&href',
    二级:'*',
    搜索:'.list-search&&p;a&&Text;;body--a&&Text;a&&href',
}


code:
var rule = {
    title:'310直播',
    host:'http://www.310.tv',
    url:'/?s=0&t=1&a=fyclass&g=fypage',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'热门&足球&篮球',
    class_url:'0&1&2',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    play_parse:false,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.list_content a;.jiabifeng&&p:lt(5)&&Text;.feleimg img&&src;a&&t-nzf-o;a&&href',
    二级:'*',
    搜索:'',
}


code:
var rule={
    title:'31看影院',
    host:'https://www.31kan.vip',
    url:'/vodshow/fyclass--------fypage---.html',
    searchUrl:'/vodsearch/**----------fypage---.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{
        'User-Agent':'UC_UA',
    },
    // class_parse:'.fed-pops-navbar&&ul.fed-part-rows&&a.fed-part-eone:gt(0):lt(5);a&&Text;a&&href;.*/(.*?).html',
    class_parse:'.myui-header__menu&&li:gt(0):lt(6);a&&Text;a&&href;.*/(.*?).html',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'ul.myui-vodlist.clearfix;li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.myui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
    二级:{"title":".myui-content__detail .title&&Text;.text-muted:eq(-1)&&Text","img":".myui-content__thumb .lazyload&&data-original","desc":".text-muted:eq(-1)&&Text;.text-muted:eq(-1)&&Text;.myui-content__detail p:eq(1)&&Text;.myui-content__detail p:eq(3)&&Text;.myui-content__detail p:eq(4)&&Text","content":".content&&Text","tabs":".nav-tabs:eq(0) li","lists":".myui-content__list:eq(#id) li"},
    搜索:'#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.text-muted:eq(-1)&&Text',
}


code:
var rule = {
    title:'539影院',
    host:'https://539539.xyz',
    // homeUrl:'/',
    url:'/vodtype/fyclass/page/fypage.html',
    headers:{
        'User-Agent':'MOBILE_UA',
        "Cookie": "searchneed=ok"
    },
    searchUrl:'/vodsearch/wd/**/page/fypage.html',
    searchable:2,
    // class_name:'电影&网剧&剧集&动漫&综艺&记录',
    // class_url:'20&1&2&3&4&23',
    class_parse:'.stui-header__menu li:gt(0):lt(5);a&&Text;a&&href;/(\\d+).html',
    play_parse:true,
    // lazy:'干饭',
    // lazy:'@js:cacheUrl = d.getParse(input);print(cacheUrl);input=cacheUrl',
    // lazy:'js:cacheUrl = d.getParse(input);print(cacheUrl);input=cacheUrl',
    // lazy:'js:cacheUrl=d.getParse(input);if(cacheUrl){input=cacheUrl}else{try{let html=fetch(input,{headers:d.headers,timeout:d.timeout,encoding:d.encoding});let ret=html.match(/var player_(.*?)=(.*?)</)[2];let url=JSON.parse(ret).url;if(url.length>10){real_url="https://player.buyaotou.xyz/?url="+url;d.saveParse(input,real_url);input=real_url}}catch(e){print("网络请求发生错误:"+e.message)}}',
    //lazy:'js:cacheUrl=getParse(input);if(cacheUrl){input=cacheUrl}else{try{let html=fetch(input,fetch_params);let ret=html.match(/var player_(.*?)=(.*?)</)[2];let url=JSON.parse(ret).url;if(url.length>10){real_url="https://player.buyaotou.xyz/?url="+url;saveParse(input,real_url);input=real_url}}catch(e){print("网络请求发生错误:"+e.message)}}',
    limit:5,
    推荐:'ul.stui-vodlist.clearfix;li;a&&title;.lazyload&&data-original;.pic-text.text-right&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'body .stui-vodlist__box;a&&title;.lazyload&&data-original;.pic-text.text-right&&Text;a&&href',
    二级:{"title":"h1.title&&Text;.stui-content__detail p:eq(1)&&Text","img":".lazyload&&data-original","desc":".stui-content__detail p:eq(-3)&&Text;.stui-content__detail p:eq(-2)&&Text","content":".stui-content__detail p.detail&&Text","tabs":".stui-vodlist__head h3","lists":".stui-vodlist__head:eq(#id)&&.stui-content__playlist li"},
    搜索:'.stui-vodlist.clearfix&&ul&&li;h4&&Text;.stui-vodlist__thumb&&data-original;.stui-vodlist__thumb.lazyload&&.pic-text.text-right&&Text;a&&href',
}


code:
var rule = Object.assign(muban.mxpro,{
title:'555影视',
// host:'https://www.555dy.app',
// host:'https://www.555yy2.com/',
// host:'https://www.555yy1.com/',
host:'https://www.555pian.com',
headers:{//网站的请求头,完整支持所有的,常带ua和cookies
    'User-Agent':'MOBILE_UA',
    "Cookie": "searchneed=ok"
},
});


code:
var rule={
    title:'69美剧',
    host:'https://www.69mj.com',
    // homeUrl:'/',
    url:'/index.php/vod/show/id/fyclass/page/fypage.html',
    searchUrl:'/index.php/vod/search.html?wd=**',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    class_parse:'.nav-menu-items&&li;a&&Text;a&&href;/(\\d+).html',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'.module-list;.module-item;a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.module&&.module-item;a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href',
    二级:{
    	"title":"h1&&Text;.video-info-aux&&Text",
    	"img":".lazyload&&data-src",
    	"desc":";;;.video-info-actor:eq(1)&&Text;.video-info-actor:eq(0)&&Text",
    	"content":".vod_content&&Text",
    	"tabs":".module-tab-item.tab-item",
    	"lists":".module-player-list:eq(#id)&&.sort-item a"
	},
    搜索:'.module&&.module-search-item;h3&&Text;.lazyload&&data-src;.video-serial&&Text;a&&href',
}


code:
var rule = {
    title: '74听书',
    host: 'https://www.ting74.com',
    // homeUrl:'/sort/xuanhuan.html',
    url:'/sort/fyclass/fypage.html',
    searchUrl: '/search.html#searchtype=novelname&searchword=**&page=fypage;post',
    searchable: 0,
    quickSearch: 0,
    filterable:0,
    headers:{'User-Agent':'PC_UA'},
    timeout:5000,//网站的全局请求超时,默认是3000毫秒
    class_parse: '.nav-ol&&li:gt(0):lt(8);a&&Text;a&&href;/(\\w+).html',
    play_parse:true,
    // lazy:"js:var url=jsp.pdfh(request(input),'iframe&&src');var purl=request('http://www.ting74.com'+url).match(/mp3:'(.*?)'/)[1];input={jx:0,url:purl,parse:0}",
    limit:6,
    推荐:'#myTab_Content0&&.tab-li;.tab-book-title&&Text;*;.tab-book-author&&Text;*',
    一级:'.list-works&&li;.list-book-dt&&a&&Text;.lazy&&data-original;.book-author--aria:eq(2)&&Text;a&&href',
    二级:{
        "title":".book-cover&&alt;.book-info&&dd--span:eq(1)&&Text",
        "img":".book-cover&&src",
        "desc":".book-info&&dd:eq(4)&&Text;;;.book-info&&dd:eq(3)&&Text;.book-info&&dd:eq(2)&&Text",
        "content":".book-des&&Text",
        "tabs":".playlist-top&&h2",
        "lists":"#playlist:eq(#id)&&li"
    },
    搜索:'*',
}


code:
var rule={
    title:'7喜影院',
    host:'https://7xi.tv',
    // host:'https://zaoii.com',
    // homeUrl:'/',
    url:'/vodshow/fyclass--------fypage---/',
    searchUrl:'/vodsearch/**----------fypage---/',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    //class_parse:'.conch-nav&&ul&&li;a&&Text;a&&href;./(\\d+).html',
    //cate_exclude:'',
    class_name:'电影&电视剧&综艺&动漫&记录片&国产剧&港台剧&日韩剧&欧美剧&海外剧',
    class_url:'1&2&3&4&21&13&14&15&16&22',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'body&&.hl-list-wrap;ul&&li;a&&title;.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.hl-vod-list&&li;a&&title;.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    二级:{"title":".hl-dc-title&&Text;.hl-col-xs-12&&em&&.hl-text-muted:eq(-2)&&Text","img":".hl-lazy&&data-original","desc":";;.hl-col-xs-12:eq(2)&&Text;.hl-col-xs-12:eq(3)&&Text;.hl-col-xs-12:eq(4)&&Text","content":".hl-content-text&&Text","tabs":".hl-plays-from a","lists":".hl-plays-list:eq(#id) li"},
    搜索:'.hl-list-wrap&&ul&&li;.hl-item-thumb&&title;.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
}


code:
var rule = {
    title:'88看球',
    // host:'http://www.88kanqiu.cc',
    host:'http://www.88kanqiu.live',
    url:'/match/fyclass/live',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_parse:'.nav-pills li;a&&Text;a&&href;/match/(\\d+)/live',
    headers:{
        'User-Agent':'PC_UA'
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.list-group .group-game-item;.d-none&&Text;img&&src;.btn&&Text;a&&href',
    二级:{
	    "title":".game-info-container&&Text;.customer-navbar-nav li&&Text",
	    "img":"img&&src",
	    "desc":";;;div.team-name:eq(0)&&Text;div.team-name:eq(1)&&Text",
	    "content":"div.game-time&&Text",
	    "tabs":"js:TABS=['88看球']",
	    // "lists":"js:LISTS=[];input=input+'-url';let html=request(input);let data=JSON.parse(html);TABS.forEach(function(tab){let m3u=data;let d=m3u.map(function(it){return it.name+'$'+play_url+it.url});LISTS.push(d)});"
	    "lists":"js:LISTS=[];input=input+'-url';let html=request(input);let data=JSON.parse(html);TABS.forEach(function(tab){let m3u=data;let d=m3u.map(function(it){return it.name+'$'+it.url});LISTS.push(d)});"
	},
    搜索:'',
}


code:
var rule={
title:'8号影院',
    host:'http://www.8hysw.com',
    // homeUrl:'/',
    url:'/frim/fyclass-fypage.html',
    searchUrl:'/search.php?page=fypage&searchword=**&searchtype=',
searchable:2,//是否启用全局搜索,
quickSearch:0,//是否启用快速搜索,
filterable:0,//是否启用分类筛选,
class_name:'电影&电视剧&综艺&动漫&日韩剧&国产剧&欧美剧&港台剧',
    class_url:'1&2&3&4&16&13&15&14',
play_parse:true,
lazy:'',
limit:6,
tab_exclude:'本周热门|最近更新',
推荐:'.stui-pannel_bd;.stui-vodlist li;h4&&Text;.lazyload&&data-original;.text-right&&Text;a&&href',
double:true, // 推荐内容是否双层定位
一级:'.stui-vodlist.clearfix&&li;a&&title;.lazyload&&data-original;.text-right&&Text;a&&href',
二级:{"title":"h1&&Text;.stui-content__detail&&p&&Text","img":".lazyload&&data-original","desc":".data:eq(0)&&Text;.data:eq(1)&&Text;.data:eq(2)&&Text;.data:eq(3)&&Text","content":".desc&&Text","tabs":".stui-pannel__head.bottom-line h3","lists":".stui-content__playlist:eq(#id) li"},
 搜索:muban.首图2.搜索2,

}


code:
var rule={
    title:'99影院',
    host:'https://99itv.net',
    url:'/show/fyclass--------fypage---.html',
    searchUrl:'/search/**----------fypage---.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{
        'User-Agent':'UC_UA',
    },
    //class_parse:'.myui-header__menu&&li;a&&Text;a&&href;.*/(.*?).html',
    class_name:'电影&电视剧&综艺&动漫&国产剧&香港剧&韩国剧&日本剧&欧美剧&泰国剧',
    class_url:'movie&drama&variety&anime&china&hkg&kr&jp&usa&tailan',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'ul.myui-vodlist.clearfix;li;a&&title;a&&data-original;.pic-tag.text-right&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.myui-vodlist li;a&&title;a&&data-original;.text-right&&Text;a&&href',
    二级:{"title":".myui-content__detail .title&&Text;.text-muted:eq(-1)&&Text","img":".myui-content__thumb .lazyload&&data-original","desc":".text-muted:eq(-1)&&Text;.text-muted:eq(-1)&&Text;.myui-content__detail p:eq(1)&&Text;.myui-content__detail p:eq(3)&&Text;.myui-content__detail p:eq(4)&&Text","content":".content&&Text","tabs":".nav-tabs:eq(0) li","lists":".myui-content__list:eq(#id) li"},
    搜索:'#searchList li;a&&title;.lazyload&&data-original;.pic-text&&Text;a&&href;.text-muted:eq(-1)&&Text',
}


code:
var rule={
		title:'9U电影',
		host:'https://www.9udy.com',
		url:'/index.php/vod/show/id/fyclass/page/fypage.html',
 		searchUrl:'/index.php/vod/search/page/fypage/wd/**.html',
		searchable:2,//是否启用全局搜索,
		quickSearch:0,//是否启用快速搜索,
		filterable:0,//是否启用分类筛选,
		//class_parse:'.nav-menu-items&&li;a&&Text;a&&href;.*/(.*?).html',
	        //cate_exclude:'演员',
	        class_name:'电影&电视剧&综艺&动漫&纪录片&国产剧&港台剧&日韩剧&欧美剧&其他',
                class_url:'1&2&3&4&28&13&14&15&16&24&30',
		play_parse:true,
		lazy:'',
		limit:6,
		推荐:'.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		double:true, // 推荐内容是否双层定位
		一级:'.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		二级:{"title":"h1&&Text;.tag-link&&Text","img":".module-item-pic&&img&&data-src","desc":".video-info-items:eq(-2)&&Text;.video-info-items:eq(-1)&&Text;.video-info-items:eq(-2)&&Text;.video-info-items:eq(1)&&.video-info-item&&Text;.video-info-items:eq(-2)&&.video-info-item&&Text","content":".zkjj_a&&Text","tabs":".module-tab-item","lists":".module-player-list:eq(#id)&&.scroll-content&&a"},
		搜索:'.module-items .module-search-item;h3&&Text;*;.video-serial&&Text;*',
}


code:
var rule = {
     title:'AB影院',
    host:'https://abu22.com/',
    url:'vodtype/fyclass-fypage.html',
    searchUrl:'/search.php#searchword=**;post',
    headers:{ 'User-Agent':'PC_UA',},
    class_name:'电影&剧集&综艺&动漫&伦理',
    class_url:'1&2&4&3&40',
    推荐:'.stui-vodlist__item;*;*;*;*',
    一级:'.stui-vodlist__item;a&&title;a&&data-original;.pic-text&&Text;a&&href',

    二级:{"title":"h3&&Text;.stui-content__detail p:eq(0)&&Text","img":".lazyload&&data-original","desc":";;;.stui-content__detail p:eq(1)&&Text;.stui-content__detail p:eq(2)&&Text","content":".stui-content__detail p:eq(5)&&Text","tabs":".stui-pannel__head.clearfix&&h3","lists":".stui-content__playlist.clearfix:eq(#id) a"},

    搜索:'ul.stui-vodlist__media&&li;*;*;*;*',
}


code:
muban.海螺3.二级.desc = '.hl-text-conch&&Text';
var rule = Object.assign(muban.海螺3,{
    title:'AnFuns动漫',
    host:'https://www.anfuns.cc',
    cate_exclude: '最新|排行',
    url:'/type/fyclass-fypage.html',
    searchUrl:'/search/page/fypage/wd/**.html',
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
    'User-Agent':'MOBILE_UA',
    "Cookie": "searchneed=ok"},
});


code:
var rule={
    title:'BD影视',
    host:'https://bd360.xyz',
    // homeUrl:'/',
    url:'/vodshow/fyclass--------fypage---.html',
    searchUrl:'/vodsearch/**----------fypage---.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    //class_parse:'.navbar-items li:gt(2):lt(8);a&&Text;a&&href;.*/(.*?).html',
    class_name:'电影&电视剧&综艺&动漫',
    class_url:'1&2&3&4',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'body .main;.module-poster-item.module-item;a&&title;img&&data-original;.module-item-note&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'a.module-poster-item.module-item;a&&title;img&&data-original;.module-item-note&&Text;a&&href',
    二级:{"title":"h1&&Text;.module-info-tag&&Text","img":".lazy.lazyload&&data-original","desc":".module-info-item:eq(-1)&&Text;.module-info-item:eq(-2)&&Text;.module-info-item:eq(-3)&&Text;.module-info-item:eq(2)&&.module-info-item-content&&Text;.module-info-item:eq(1)&&.module-info-item-content&&Text","content":".module-info-introduction&&Text","tabs":".module-tab-item.tab-item","lists":".module-list:eq(#id)&&.module-play-list a"},
    搜索:'body .module-item;.module-card-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href;.module-info-item-content&&Text',
}


code:
var rule = {
    title:'DJ音乐',
    host:'http://www.djuu.com',
    homeUrl:'/exclusive/115_1.html',//网站的首页链接,可以是完整路径或者相对路径,用于分类获取和推荐获取 fyclass是分类标签 fypage是页数
    url:'/djlist/fyclass_fypage.html',
    searchUrl:'/search?musicname=**',
    searchable:2,
    quickSearch:0,
    class_parse:'#top_banner_bg div;a&&Text;a&&href;/djlist/(\\d+)_1.html',
    headers:{
        'User-Agent':'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.141 Mobile Safari/537.36'
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.list_musiclist tr:gt(0);a&&title;img&&src;.cor999:eq(1)&&Text;a&&href',
    二级:'*',
    搜索:'*;*;*;.sc_1&&Text;*',
}


code:
muban.mxone5.二级.tabs = '.module-tab-item';
muban.mxone5.二级.lists = '.module-player-list:eq(#id)&&.scroll-content&&a';
var rule = Object.assign(muban.mxone5,{
title:'Fun4K',
host:'https://www.fun4k.com',
url:'/vod/fyclass--------fypage---/',
searchUrl:'/vodsearch/**----------fypage---/',
class_parse:'.nav ul li;a&&Text;a&&href;.*/(.*?)/',
cate_exclude: 'Bilibili|虎牙',
headers:{
		'User-Agent':'PC_UA',
	},
});


code:
muban.首图.二级.tabs = '.nav.nav-tabs.active&&li';
muban.首图.二级.lists='.myui-content__list.sort-list.clearfix:eq(#id)&&li';

var rule = Object.assign(muban.首图,{
title:'HDmoli',
host:'https://www.hdmoli.com',
url:'/mlist/fyclass-fypage.html',
searchUrl:'/search/-------------.html?wd=*&submit=',
class_name:'电影&剧集&动漫',//静态分类名称拼接
class_url:'index1&index2&index41',//静态分类标识拼接
class_parse:'',
一级:'.myui-vodlist li;a&&title;a&&data-original;.pic-text&&Text;a&&href',
});


code:
var rule = {
    title:'HoHo影视',
    host:'https://www.hoho.tv',
    // homeUrl:'/',
    url:'/vod/show/fyclass/page/fypage.html',
    searchUrl:'/vod/search/page/fypage/wd/**.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    //class_parse:'.nav-menu-items&&li;a&&title;a&&href;/(\\d+).html',
    class_name:'电影&电视剧&综艺&动漫&纪录片',
    class_url:'1&2&3&4&20',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'.module-item;.module-item-cover&&.module-item-pic;a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.module-list&&.module-item;.module-item-pic&&a&&title;.lazyloaded&&data-src;.module-item-text&&Text;a&&href',
    二级:{"title":"h1&&Text;.video-info-aux.scroll-content&&Text","img":".lazyload&&data-src","desc":".module-info-content&&.module-info-item:eq(-2)&&Text;.module-info-content&&.module-info-item:eq(-2)&&Text;.module-info-content&&.module-info-item:eq(-2)&&Text;.video-info-items:eq(1)&&.video-info-item.video-info-actor&&Text;.video-info-items:eq(0)&&.video-info-item.video-info-actor&&Text","content":".video-info-item.video-info-content.vod_content&&Text","tabs":".module-tab-content&&.module-tab-item.tab-item","lists":".module-blocklist.scroll-box.scroll-box-y:eq(0)&&.scroll-content a"},
    搜索:'.module-search-item;.lazy.lazyload&&alt;img&&data-src;.video-serial&&Text;a.video-serial&&href',
}


code:
// 道长 drpy仓库 https://gitcode.net/qq_32394351/dr_py
// 道长 drpy安卓本地搭建说明 https://gitcode.net/qq_32394351/dr_py/-/blob/master/%E5%AE%89%E5%8D%93%E6%9C%AC%E5%9C%B0%E6%90%AD%E5%BB%BA%E8%AF%B4%E6%98%8E.md
// 道长 drpy写源 模板规则说明 https://gitcode.net/supertlo/dr_py#%E6%A8%A1%E6%9D%BF%E8%A7%84%E5%88%99%E8%AF%B4%E6%98%8E
// 道长 drpy写源 套模模版 https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/%E6%A8%A1%E6%9D%BF.js
// 道长 drpy写源 影片教程 http://101.34.67.237:5244/%E6%95%99%E8%82%B2/drpy
// 道长 drpy写源 影片教程(m3u8切片) https://freedrpy.run.goorm.io/txt/jc/playlist.m3u8
// 海阔下载 https://haikuo.lanzoui.com/u/GoldRiver
// Pluto Player官方TG https://t.me/PlutoPlayer
// Pluto Player官方TG https://t.me/PlutoPlayerChannel

var rule = {
    title:'JRKAN直播',
    host:'http://jrkankan.com',
	// JRKAN备用域名:jrkan365.com / jrkankan.com / jryyds.com / jrsbxj.com
	// JRKAN网址发布:qiumi1314.com
    url:'/fyclass',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'全部',
    class_url:'/',
    //class_url:'?live',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    // 一级播放线路x3 可自行切换
    // 一级:'.loc_match .d-touch;li&&Text;img&&src;.lab_time&&Text;a:eq(0)&&href',//play.sportsteam365.com
    一级:'.loc_match:eq(2) ul;li:gt(1):lt(4)&&Text;img&&src;li:lt(2)&&Text;a:eq(1)&&href',//play.sportsteam333.com
    // 一级:'.loc_match .d-touch;li&&Text;img&&src;.lab_time&&Text;a:eq(2)&&href',//play.sportsteam666.com
    二级:{title:'.sub_list li:lt(2)&&Text;.sub_list li:eq(0)&&Text',img:'img&&src',desc:';;;.lab_team_home&&Text;.lab_team_away&&Text',content:'.sub_list ul&&Text',tabs:'',tab_text:'',lists:'.sub_channel a',list_text:'a&&Text',list_url:'a&&data-play'},
    搜索:'',
}


code:
var rule = {
    title:'JRS录像',
    host:'http://m.jrskqw.net',
    url:'http://m.jrskqw.net/video/fyclass/',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'篮球&足球',
    class_url:'nba&zq',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    play_parse:true,
    play_json:1,
    // lazy:'js:input={parse:1,jx:1,url:input}',
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.videotape a;.list p:eq(-1)&&Text;img&&src;.list p:eq(2)&&Text;a&&href',
    二级:{title:'.box&&Text',img:'img:eq(1)&&src',desc:';;;.teamOne&&Text;.teamTwo&&Text',content:'.score&&Text',tabs:'',tab_text:'',lists:'#checked-jjlx a',list_text:'p&&Text',list_url:'a&&href'},
    搜索:'',
}


code:
var rule = {
    title:'JRS看比赛',
    host:'https://m.jrskbs.com',
    url:'/fyclass',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'全部',
    class_url:'/',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.contentList a;.contentBody&&Text;.contentLeft img&&src;.contentCenter p:eq(1)&&Text;a&&href',
    二级:{title:'.vs-wrap&&Text;.vs-wrap&&Text',img:'.vs img&&src',desc:';;;.vs:eq(0)&&Text;.vs:eq(2)&&Text',content:'.time1&&Text',tabs:'',tab_text:'',lists:'.liveshow a',list_text:'a&&Text',list_url:'a&&data-url'},
    搜索:'',
}


code:
var rule = {
    title:'JRS看球网',
    host:'http://www.jrskanqiu.com',
    url:'/fyclass',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'全部',
    class_url:'/',
    headers:{
        'User-Agent':'MOBILE_UA',
        "Cookie": "searchneed=ok"
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.todayMatch .contenTab;.myList div:gt(0)&&Text;img&&src;.status&&Text;a&&href',
    二级:{title:'.msg ul&&Text;.msg ul&&Text',img:'img:eq(2)&&src',desc:';;;.nameOne&&Text;.nameTwo&&Text',content:'._t&&Text',tabs:'.checkChannel li:eq(0)',tab_text:'p&&Text',lists:'.checkChannel li:gt(0)',list_text:'a&&Text',list_url:'a&&data-url'},
    搜索:'',
}


code:
var rule = {
    title:'JRS看直播',
    host:'http://www.jrskan.net',
    url:'/fyclass',
    searchUrl:'',
    searchable:0,
    quickSearch:0,
    class_name:'全部',
    class_url:'/',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    play_parse:true,
    lazy:'',
    limit:6,
    double:false,
    推荐:'*',
    一级:'.row a;li div:gt(2):lt(6)&&Text;img&&src;.match-start-time&&Text;a&&href',
    二级:{title:'.live-title&&Text;.live-title&&Text',img:'img:eq(1)&&src',desc:';;;.live-left-team-sj&&Text;.live-right-team-sj&&Text',content:'.live-info&&Text',tabs:'',tab_text:'',lists:'#item-source a',list_text:'a&&Text',list_url:'a&&data-url'},
    搜索:'',
}


code:
var rule = {
    title:'KUBO影视',
    host:'https://123kubo.tv',
    // homeUrl:'/',
    url:'/show/fyclass/page/fypage.html',
    searchUrl:'/search/page/fypage/wd/**.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    class_name:'电影&电视剧&综艺&动漫',
    class_url:'1&2&3&4',
    //class_parse:'.myui-panel-box&&ul&&li;a&&Text;a&&href;/v/(.*)/',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'ul.hl-vod-list;li;a&&title;.hl-item-thumb.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.hl-list-item;a&&title;.hl-item-thumb.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    二级:{"title":".hl-item-thumb.hl-lazy&&title;.hl-full-box&&ul li:eq(6)&&Text","img":".hl-item-thumb.hl-lazy&&data-original","desc":".hl-full-box&&ul&&li:eq(-1)&&Text;.hl-full-box&&ul&&li:eq(-2)&&Text;.hl-full-box&&ul&&li:eq(-3)&&Text;.hl-full-box&&ul&&li:eq(2)&&Text;.hl-full-box&&ul&&li:eq(3)&&Text","content":".hl-col-xs-12.blurb&&Text","tabs":".hl-plays-from:eq(0) a","lists":".hl-plays-list:eq(#id) li"},
    搜索:'.hl-item-div;a&&title;.hl-item-thumb&&data-original;.hl-lc-1&&Text;a&&href;.text-muted:eq(-1)&&Text',
}


code:
var rule = {
    title:'KUBO影视',
    host:'https://123kubo.tv',
    // homeUrl:'/',
    url:'/show/fyclass/page/fypage.html',
    searchUrl:'/search/page/fypage/wd/**.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    class_name:'电影&电视剧&综艺&动漫',
    class_url:'1&2&3&4',
    //class_parse:'.myui-panel-box&&ul&&li;a&&Text;a&&href;/v/(.*)/',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'ul.hl-vod-list;li;a&&title;.hl-item-thumb.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.hl-list-item;a&&title;.hl-item-thumb.hl-lazy&&data-original;.hl-pic-text&&Text;a&&href',
    二级:{"title":".hl-item-thumb.hl-lazy&&title;.hl-full-box&&ul li:eq(6)&&Text","img":".hl-item-thumb.hl-lazy&&data-original","desc":".hl-full-box&&ul&&li:eq(1)&&Text;.hl-full-box&&ul&&li:eq(2)&&Text;.hl-full-box&&ul&&li:eq(3)&&Text","content":".hl-col-xs-12.blurb&&Text","tabs":".hl-plays-from:eq(0) a","lists":".hl-plays-list:eq(#id) li"},
    搜索:'.hl-item-div;a&&title;.hl-item-thumb&&data-original;.hl-lc-1&&Text;a&&href;.text-muted:eq(-1)&&Text',
}


code:
var rule = Object.assign(muban.mxpro,{
	title:'MXONE',
    host:'https://www.jpys.me',
    url:'vodshow/fyclass--------fypage---.html',
    searchUrl:'/vodsearch/**----------fypage---.html/',
    class_name:'电影&电视剧&动漫&综艺',
    class_url:'1&2&3&4',
	class_parse:'',
});


code:
var rule = {
    title:'Missav',
    host:'https://missav.com',
	searchUrl:'/cn/search/**',
    url:'/cn/fyclass?page=fypage',
    headers:{
        'User-Agent':'MOBILE_UA'
    },
    timeout:5000,
    class_name:'最近更新&新作上市&无码流出&SIRO&LUXU&GANA&PRESTIGE&S-CUTE&ARA&FC2&麻豆传媒&本月热门',//静态分类名称拼接
    class_url:'new&release&uncensored-leak&siro&luxu&gana&maan&scute&ara&fc2&madou&monthly-hot',//静态分类标识拼接
    limit:5,
    play_parse:true,
    lazy:'',
    一级:'.grid.grid-cols-2 div&&a;.lozad.w-full&&alt;.lozad.w-full&&data-src;.absolute.bottom-1&&Text;a&&href',
    二级:'*',
	搜索:'.grid.grid-cols-2 div&&a;.lozad.w-full&&alt;.lozad.w-full&&data-src;.absolute.bottom-1&&Text;a&&href',
	searchable:1,//是否启用全局搜索,
    quickSearch:1,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
}


code:
var rule={
		title:'NY影院',
		host:'https://www.nycvod.com',
		url:'/vodshow/fyclass--------fypage---.html',
 		searchUrl:'/vodsearch/**----------fypage---.html',
		searchable:2,//是否启用全局搜索,
		quickSearch:0,//是否启用快速搜索,
		filterable:0,//是否启用分类筛选,
		//class_parse:'.nav-menu-items&&li;a&&Text;a&&href;.*/(.*?).html',
	        //cate_exclude:'演员',
	        class_name:'电影&电视剧&综艺&动漫&纪录片&竞技体育&国产剧&港台剧&日韩剧&欧美剧&新马泰&其他',
                class_url:'1&2&26&32&23&40&13&15&14&16&24&25',
		play_parse:true,
		lazy:'',
		limit:6,
		推荐:'.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		double:true, // 推荐内容是否双层定位
		一级:'.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
		二级:{"title":"h1&&Text;.tag-link&&Text","img":".module-item-pic&&img&&data-src","desc":".video-info-items:eq(-2)&&Text;.video-info-items:eq(-1)&&Text;.video-info-items:eq(-2)&&Text;.video-info-items:eq(1)&&.video-info-item&&Text;.video-info-items:eq(0)&&.video-info-item&&Text","content":".vod_content&&Text","tabs":".module-tab-item","lists":".module-player-list:eq(#id)&&.scroll-content&&a"},
		搜索:'.module-items .module-search-item;h3&&Text;*;.video-serial&&Text;*',
}


code:
var rule = Object.assign(muban.mxpro,{
title:'Nike影视',
host:'https://www.ajeee.com',
url:'/show/fyclass/page/fypage.html',
class_name:'电影&电视剧&综艺&动漫',
class_url:'Movie&Tv&Variety&Cartoon',
class_parse:'',
});


code:
var rule = {
    title:'RP影视',
    host:'https://mac.rp123.top',
    url:'/vodshow/fyclass--hits------fypage---/',
    searchUrl:'/vodsearch/-------------/?wd=**',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{'User-Agent':'MOBILE_UA',},
    class_name:'电影&电视剧&综艺&动漫&纪录片&4K专区',
    class_url:'1&2&3&4&35&40',
    推荐:'.module-poster-item;*;*;*;*',
    一级:'.module-poster-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href',
    二级:{"title":"h1&&Text;.module-info-tag-link a&&Text","img":".alignnone&&src","desc":";;;.module-info-items div:eq(4) a&&Text;.module-info-items div:eq(3) a&&Text","content":".show-desc&&Text","tabs":".module-tab-items-box span","lists":".module-play-list:eq(#id) a"},
    搜索:'.module-card-item-poster;img&&alt;.lazyload&&data-original;.module-item-note&&Text;a&&href',
}


code:
var rule = {
    title:'TV蜂',
    host:'https://www.tvfeng.net',
    // homeUrl:'/',
    url:'/tvfenshow/fyclass--------fypage---.html',
    searchUrl:'/tvfensearch/**----------fypage---.html',
    searchable:2,//是否启用全局搜索,
    quickSearch:0,//是否启用快速搜索,
    filterable:0,//是否启用分类筛选,
    headers:{//网站的请求头,完整支持所有的,常带ua和cookies
        'User-Agent':'MOBILE_UA',
        // "Cookie": "searchneed=ok"
    },
    class_name:'电影&电视剧&综艺&动漫',
    class_url:'1&2&3&4',
    play_parse:true,
    lazy:'',
    limit:6,
    推荐:'.module-list;.module-items&&.module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
    double:true, // 推荐内容是否双层定位
    一级:'.module-items .module-item;a&&title;img&&data-src;.module-item-text&&Text;a&&href',
    二级:{"title":"h1&&Text;.tag-link&&Text","img":".module-item-pic&&img&&data-src","desc":".video-info-items:eq(0)&&Text;.video-info-items:eq(3)&&Text;.video-info-items:eq(2)&&Text;.video-info-items:eq(1)&&Text","content":".vod_content&&Text","tabs":".module-tab-item","lists":".module-player-list:eq(#id)&&.scroll-content&&a"},
    搜索:'.module-items .module-search-item;h3&&Text;img&&data-src;.video-serial&&Text;a&&href',
}


code:
// 道长 drpy仓库 https://gitcode.net/qq_32394351/dr_py
// 道长 drpy安卓本地搭建说明 https://gitcode.net/qq_32394351/dr_py/-/blob/master/%E5%AE%89%E5%8D%93%E6%9C%AC%E5%9C%B0%E6%90%AD%E5%BB%BA%E8%AF%B4%E6%98%8E.md
// 道长 drpy写源 模板规则说明 https://gitcode.net/supertlo/dr_py#%E6%A8%A1%E6%9D%BF%E8%A7%84%E5%88%99%E8%AF%B4%E6%98%8E
// 道长 drpy写源 套模模版 https://gitcode.net/qq_32394351/dr_py/-/raw/master/js/%E6%A8%A1%E6%9D%BF.js
// 道长 drpy写源 影片教程 http://101.34.67.237:5244/%E6%95%99%E8%82%B2/drpy
// 道长 drpy写源 影片教程(m3u8切片) https://freedrpy.run.goorm.io/txt/jc/playlist.m3u8
// 海阔下载 https://haikuo.lanzoui.com/u/GoldRiver
// Pluto Player官方TG https://t.me/PlutoPlayer
// Pluto Player官方TG https://t.me/PlutoPlayerChannel

// 已知问题:
// js0 无法嗅探播放
// js1 俊壳,PythonBox 嗅探播放正常
// js1 Pluto + 简易lazy,解决有声音没画面! 嗅探播放也正常

var rule = {
    title:'UrleBird',
    host:'https://urlebird.com',
    homeUrl:'/trending/',
    url:'fyclass/page/fypage/[fyclass/]',
    searchUrl:'/search/?q=**',//Search @user or #hash
    searchable:2,
    quickSearch:0,
    class_name:'更新&人气&热搜',
    class_url:'videos&videos/popular&trending',
    headers:{
        'User-Agent':'PC_UA'
    },
    timeout:5000,
    play_parse:true,
    //lazy:'',
    lazy:'js:let html=request(input);let rurl=html.match(/video src="(.*?)"/)[1];input={parse:0,url:rurl};',
    limit:10,
    double:false,
    推荐:'*',
    一级:'.text-md-left .thumb;.author-name&&Text;.img img&&data-src;.info3 a:eq(1)&&Text;.info3 a:eq(1)&&href',
    //一级:'.text-md-left .thumb;.author-name&&Text;.img img&&src;.info3 a:eq(1)&&Text;.info3 a:eq(1)&&href',
    二级:'*',
    搜索:'*',
}


code:
var rule = {
    title:'A8音乐',
    host:'http://v.a8.com',
    url:'/category/fyclass?p=fypage',
    searchUrl:'/search?t=**',
    searchable:2,
    quickSearch:0,
    headers:{
        'User-Agent':'MOBILE_UA',
    },
    class_parse: '.categorys-inner li:gt(1):lt(7);a&&Text;a&&href;.*/(\\d+)',
    timeout:5000,
    limit:6,
    play_parse:true,
    lazy:'js:let html=request(input);let purl=jsp.pdfh(html,".video-js&&source&&src");input={jx:0,url:purl,parse:0}',
    推荐: '.v-list-body:eq(1)&&.v_item;*;*;*;*',
    一级: '.list-div&&.v_item;img&&alt;img&&data-original;.v-time&&Text;a&&href',
    二级:'*',
    搜索:'.v-list-body&&.v_item;*;*;*;*',
}


code:
var rule = {
    title:'网易公版影像',
    host:'https://active.163.com',
    homeUrl:'/service/form/v1/9347/view/1618.jsonp?param_entry_kinds=his&page=1&pageSize=20',
    url:'/service/form/v1/9347/view/1618.jsonp?param_entry_kinds=fyclass&page=fypage&pageSize=20',
    class_name:'电影&纪录片&动画片&珍贵史料',
    class_url:'movie&doc&ani&his',
    searchUrl:'/service/form/v1/9347/view/1619.jsonp?_charset=UTF-8&_decode=UTF-8&param_title=**&page=fypage&pageSize=6',
    searchable:2,
    quickSearch:0,
    headers:{
        'User-Agent':'MOBILE_UA',
    },
    timeout:5000,
    limit:6,
    play_parse:true,
    lazy:'js:let vid = input.split("/view/")[1];var playJsonUrl="https://so.v.163.com/mobile/getBatchOnlineVideo.do?vidstr=";var reqUrl=playJsonUrl+vid;var reqJson=JSON.parse(request(reqUrl)).data.video_list[0];input={jx:0,url:reqJson.mp4SdUrl,parse:0}',
    // lazy:'',
    推荐:'*',
    一级:'json:list;title;cover_pic;meida_type;vid',
    二级:'*',
    搜索:'*',
}


code:
# c=[];for(let i in a){c.push(i+','+a[i])}d=c.join('\n');console.log(d);
🔮嗨翻,https://pan.hikerfans.com
🦀9T(Adult),https://drive.9t.ee
🐱梓澪の妙妙屋,https://xn--i0v44m.xyz
🚆资源小站,https://pan.142856.xyz
🌤晴园的宝藏库,https://alist.52qy.repl.co
🐭米奇妙妙屋,https://anime.mqmmw.ga
💂小兵组网盘影视,https://6vv.app
📀小光盘,https://alist.xiaoguanxiaocheng.life
🐋一只鱼,https://alist.youte.ml
🌊七米蓝,https://al.chirmyram.com
🌴非盘,http://www.feifwp.top
🥼帅盘,https://hi.shuaipeng.wang
🐉神族九帝,https://alist.shenzjd.com
☃姬路白雪,https://pan.jlbx.xyz
🎧听闻网盘,https://wangpan.sangxuesheng.com
💾DISK,http://124.222.140.243:8080
🌨云播放,https://quanzi.laoxianghuijia.cn
✨星梦,https://pan.bashroot.top
🌊小江,https://dyj.me
💫触光,https://pan.ichuguang.com
🕵好汉吧,https://8023.haohanba.cn
🥗AUNEY,http://121.227.25.116:8008
🎡资源小站,https://960303.xyz/
🏝fenwe,http://www.fenwe.tk:5244
🎢轻弹浅唱,https://g.xiang.lol


code:
import _ from 'https://underscorejs.org/underscore-esm-min.js'
import { distance } from 'https://unpkg.com/fastest-levenshtein@1.0.16/esm/mod.js'

/**
 * alist js
 * 配置设置 {"key":"Alist","name":"Alist","type":3,"api":"http://xxx.com/alist.js","searchable":0,"quickSearch":0,"filterable":0,"ext":"http://xxx.com/alist.json"}
 * alist.json [{
				name:'名称',
				server:'地址',
				startPage:'/',		 //启动文件夹
				showAll: false ,	//是否显示全部文件，默认false只显示 视频和文件夹
				params:{ 			//对应文件夹参数 如设置对应文件夹的密码
					'/abc':{ password : '123' },
					'/abc/abc':{ password : '123' },
				}
		}]
 * 提示 想要加载文件夹里面全部视频到详情（看剧可以自动播放下一集支持历史记录）
 *		需要改软件才能支持，，建议长按文件夹时添加判断 tag == folder 时跳转 DetailActivity
 */

const http = function (url, options = {}) {
	if(options.method =='POST' && options.data){
		options.body = JSON.stringify(options.data)
		options.headers = Object.assign({'content-type':'application/json'}, options.headers)
	}
    const res = req(url, options);
    res.json = () => res.content ? JSON.parse(res.content) : null;
    res.text = () => res.content;
    return res
};
["get", "post"].forEach(method => {
    http[method] = function (url, options = {}) {
        return http(url, Object.assign(options, {method: method.toUpperCase()}));
    }
})

const __drives = {}

function get_drives_path(tid) {
	const index = tid.indexOf('$');
	const name = tid.substring(0, index);
	const path = tid.substring(index + 1)
	return { drives: get_drives(name), path }
}

function get_drives(name) {
	const { settings, api, server } = __drives[name]
	if (settings.v3 == null) { //获取 设置
		settings.v3 = false
		const data = http.get(server + '/api/public/settings').json().data;
		if (_.isArray(data)) {
			settings.title = data.find(x => x.key == 'title')?.value;
			settings.v3 = false;
			settings.version = data.find(x => x.key == 'version')?.value;
			settings.enableSearch = data.find(x => x.key == 'enable search')?.value == 'true';
		} else {
			settings.title = data.title;
			settings.v3 = true;
			settings.version = data.version;
			settings.enableSearch = false; //v3 没有找到 搜索配置
		}
		//不同版本 接口不一样
		api.path = settings.v3 ? '/api/fs/list' : '/api/public/path';
		api.file = settings.v3 ? '/api/fs/get' : '/api/public/path';
		api.search = settings.v3 ? '/api/public/search' : '/api/public/search';
	}
	return __drives[name]
}

function init(ext) {
	const data = http.get(ext).json();
	data.forEach(item => __drives[item.name] = {
		name: item.name,
		server: item.server.endsWith("/") ? url.substring(0, item.server.length() - 1) : item.server,
		startPage: item.startPage || '/', //首页
		showAll: item.showAll === true, //默认只显示 视频和文件夹，如果想显示全部 showAll 设置true
		params: item.params || {},
		_path_param: item.params ? _.sortBy(Object.keys(item.params), function(x) { return -x.length }) : [],
		settings: {},
		api: {},
		getParams(path) {
			const key = this._path_param.find(x => path.startsWith(x))
			return Object.assign({}, this.params[key], { path })
		},
		getPath(path) {
			const res = http.post(this.server + this.api.path, { data: this.getParams(path) }).json()
			return this.settings.v3 ? res.data.content : res.data.files
		},
		getFile(path) {
			const res = http.post(this.server + this.api.file, { data: this.getParams(path) }).json()
			const data = this.settings.v3 ? res.data : res.data.files[0]
			if (!this.settings.v3) data.raw_url = data.url //v2 的url和v3不一样
			return data
		},
		isFolder(data) { return data.type == 1 },
		isVideo(data) { //判断是否是 视频文件
			return this.settings.v3 ? data.type == 2 : data.type == 3
		},
		is_subt(data) {
			if (data.type == 1) return false
			const ext = [".srt", ".ass", ".scc", ".stl", ".ttml"]
			return ext.some(x => data.name.endsWith(x))
		},
		getPic(data) {
			let pic = this.settings.v3 ? data.thumb : data.thumbnail;
			return pic || (this.isFolder(data) ? "http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png" : '')
		}
	})
}

function home(filter) {
	let classes = Object.keys(__drives).map(key => ({
		type_id: `${key}$${__drives[key].startPage}`,
		type_name: key,
		type_flag: '1',
	}))
	return JSON.stringify({ 'class': classes });
}

function homeVod(params) {
	return JSON.stringify({ 'list': [] })
}

function category(tid, pg, filter, extend) {
	let { drives, path } = get_drives_path(tid)
	const id = tid.endsWith('/') ? tid : tid + '/'
	const list = drives.getPath(path)
	let subList = []
	let vodFiles = []
	let allList = []
	list.forEach(item => {
		if (drives.is_subt(item)) subList.push(item.name)
		if (!drives.showAll && !drives.isFolder(item) && !drives.isVideo(item)) return //只显示视频文件和文件夹
		let remark = get_size(item.size)
		const vod = {
			'vod_id': id + item.name + (drives.isFolder(item) ? '/' : ''),
			'vod_name': item.name.replaceAll("$", "").replaceAll("#", ""),
			'vod_pic': drives.getPic(item),
			'vod_tag': drives.isFolder(item) ? 'folder' : 'file',
			'vod_remarks': drives.isFolder(item) ? remark + ' 文件夹' : remark
		}
		if (drives.isVideo(item)) vodFiles.push(vod)
		allList.push(vod)
	})

	if (vodFiles.length == 1 && subList.length > 0) { //只有一个视频 一个或者多个字幕 取相似度最高的
		let sub = subList.length == 1 ? subList[0] : _.chain(allList).sortBy(x => (x.includes('chs') ? 100 : 0) + levenshteinDistance(x, vodFiles[0].vod_name)).last().value()
		vodFiles[0].vod_id += "@@@" + sub
		//vodFiles[0].vod_remarks += " 有字幕"
	} else {
		vodFiles.forEach(item => {
			const lh = 0
			let sub
			subList.forEach(s => {
				//编辑距离相似度
				const l = levenshteinDistance(s, item.vod_name)
				if (l > 60 && l > lh) sub = s
			})
			if (sub) {
				item.vod_id += "@@@" + sub
				//item.vod_remarks += " 有字幕"
			}
		})
	}

	return JSON.stringify({
		'page': 1,
		'pagecount': 1,
		'limit': allList.length,
		'total': allList.length,
		'list': allList,
	});
}

function detail(tid) {
	let { drives, path } = get_drives_path(tid)
	if (path.endsWith("/")) { //长按文件夹可以 加载里面全部视频到详情
		const content = category(tid, null, false, null)
		const { list } = JSON.parse(content)
		const vod_play_url = []
		list.forEach(x => {
			if (x.vod_tag == 'file') vod_play_url.push(`${x.vod_name}$${x.vod_id.substring(x.vod_id.indexOf('$') + 1)}`)
		})
		const pl = path.split("/");
		const vod_name = pl[pl.length - 2] || drives.name;
		let vod = {
			vod_id: tid,
			vod_name: vod_name,
			type_name: "文件夹",
			vod_pic: "https://avatars.githubusercontent.com/u/97389433?s=200&v=4",
			vod_content: tid,
			vod_tag: 'folder',
			vod_play_from: drives.name,
			vod_play_url: vod_play_url.join('#'),
			vod_remarks: drives.settings.title,
		}
		return JSON.stringify({ 'list': [vod] })
	} else {
		let paths = path.split("@@@");
		let vod_name = paths[0].substring(paths[0].lastIndexOf("/") + 1)
		let vod = {
			vod_id: tid,
			vod_name: vod_name,
			type_name: "文件",
			vod_pic: "https://avatars.githubusercontent.com/u/97389433?s=200&v=4",
			vod_content: tid,
			vod_play_from: drives.name,
			vod_play_url: vod_name + "$" + path,
			vod_remarks: drives.settings.title,
		}
		return JSON.stringify({
			'list': [vod]
		});
	}
}

function play(flag, id, flags) {
	const drives = get_drives(flag)
	const urls = id.split("@@@")
	const vod = {
		'parse': 0,
		'playUrl': '',
		'url': drives.getFile(urls[0]).raw_url
	}
	if (urls.length >= 2) {
		const path = urls[0].substring(0, urls[0].lastIndexOf('/') + 1)
		vod.subt = drives.getFile(path + urls[1]).raw_url
	}
	return JSON.stringify(vod)
}

function search(wd, quick) {
	return JSON.stringify({
		'list': []
	});
}

function get_size(sz) {
	if (sz <= 0) return "";
	let filesize = "";
	if (sz > 1024 * 1024 * 1024 * 1024.0) {
		sz /= (1024 * 1024 * 1024 * 1024.0);
		filesize = "TB";
	} else if (sz > 1024 * 1024 * 1024.0) {
		sz /= (1024 * 1024 * 1024.0);
		filesize = "GB";
	} else if (sz > 1024 * 1024.0) {
		sz /= (1024 * 1024.0);
		filesize = "MB";
	} else {
		sz /= 1024.0;
		filesize = "KB";
	}
	return sz.toFixed(2) + filesize
}

function levenshteinDistance(str1, str2) {
    return 100 - 100 * distance(str1, str2) / Math.max(str1.length, str2.length)
}

__JS_SPIDER__ = {
	init: init,
	home: home,
	homeVod: homeVod,
	category: category,
	detail: detail,
	play: play,
	search: search
}


code:
[
{name:'米奇妙妙屋',server:'https://anime.mqmmw.ga',startPage:'/',showAll: false , params:{ }}
]