/* 直播弹幕 -> vod_area:'bilidanmu'
目前只有皮皮虾大佬的DMBox, 支持弹幕
DMBox下载:https://t.me/pipixiawerun
设置 > 窗口预览 > 开启
*/

/* Cookie设置
Cookie改为预设获取蜂蜜大佬Github的
https://github.com/FongMi/CatVodSpider/raw/main/txt/cookie.txt

Cookie获取方法
https://github.com/UndCover/PyramidStore/blob/main/list.md#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9

Cookie设置方法1: DR-PY 后台管理界面
CMS后台管理 > 设置中心 > 环境变量 > {"bili_cookie":"XXXXXXX","vmid":"XXXXXX"} > 保存

Cookie设置方法2: 手动替换Cookie
底下代码 headers的
"Cookie":"$bili_cookie"
手动替换为
"Cookie":"将获取的Cookie黏贴在这"
*/

var rule = {
    title:'我的哔哩',
    host:'https://api.bilibili.com',
    homeUrl:'/x/web-interface/search/type?search_type=video&keyword=小姐姐4K&page=1',
    url:'/x/web-interface/search/type?search_type=videofyfilter',
    class_name:'中国女团&日本女团&韩国女团&印度歌舞&古风舞蹈&热舞&宅舞&舞蹈',
    class_url:'中国女团&日本女团&韩国女团&印度歌舞&古风舞蹈&热舞&宅舞&舞蹈',
    filterable: 1,
    filter_url: '&keyword={{fl.tid}}&page=fypage&duration={{fl.duration}}&order={{fl.order}}',
    filter_def:{
        中国女团:{tid:'中国女团'},
        日本女团:{tid:'日本女团'},
        韩国女团:{tid:'韩国女团'},
        印度歌舞:{tid:'印度歌舞'},
        古风舞蹈:{tid:'古风舞蹈'},
        热舞:{tid:'热舞'},
        宅舞:{tid:'宅舞'},
        舞蹈:{tid:'舞蹈'}




[{
        "type_name": "舞蹈",
        "type_id": "舞蹈MV 4K"
    },
    {
        "type_name": "宅舞",
        "type_id": "宅舞 4K"
    },
    {
        "type_name": "热舞",
        "type_id": "热舞 4K"
    },
    {
        "type_name": "古风舞蹈",
        "type_id": "古风舞蹈 4K"
    },
    {
        "type_name": "印度歌舞",
        "type_id": "印度歌舞 4K"
    },
    {
        "type_name": "中国女团",
        "type_id": "中国女团 4K"
    },
    {
        "type_name": "日本女团",
        "type_id": "日本女团 4K"
    },
    {
        "type_name": "韩国女团",
        "type_id": "韩国女团 4K"
    }],



    },
    filter: {
   "舞蹈": [{ "key": "tid",
        "name": "分类",
        "value": [
       { "n": "全部",   "v": "舞蹈"  },
       { "n": "宅舞",   "v": "宅舞"  },
       { "n": "街舞",   "v": "街舞"  },
       { "n": "明星舞蹈", "v": "明星舞蹈" },
       { "n": "韩舞",  "v": "韩舞"  },
       { "n": "古典舞", "v": "古典舞"},
       { "n": "翻跳", "v": "翻跳" },
        {
            "n": "中国舞",
            "v": "中国舞"
        },
        {
            "n": "古风舞",
            "v": "古风舞"
        },
        {
            "n": "现代舞",
            "v": "现代舞"
        },
        {
            "n": "爵士舞",
            "v": "爵士舞"
        },
        {
            "n": "芭蕾",
            "v": "芭蕾"
        },
        {
            "n": "编舞",
            "v": "编舞"
        },
        {
            "n": "POPPING",
            "v": "POPPING"
        },
        {
            "n": "极乐净土",
            "v": "极乐净土"
        },
        {
            "n": "桃源恋歌",
            "v": "桃源恋歌"
        },
        {
            "n": "新宝岛",
            "v": "新宝岛"
        },
        {
            "n": "拉丁舞",
            "v": "拉丁舞"
        },
        {
            "n": "蹦迪",
            "v": "蹦迪"
        },
        {
            "n": "民族舞",
            "v": "民族舞"
        },
        {
            "n": "抖肩舞",
            "v": "抖肩舞"
        },
        {
            "n": "齐舞",
            "v": "齐舞"
        },
        {
            "n": "机械舞",
            "v": "机械舞"
        },
        {
            "n": "广场舞",
            "v": "广场舞"
        },
        {
            "n": "BDF",
            "v": "BDF"
        },
        {
            "n": "抖音合集",
            "v": "抖音合集"
        },
        {
            "n": "快手美女合集",
            "v": "快手美女合集"
        },
        {
            "n": "练习室",
            "v": "练习室"
        },
        {
            "n": "美女舞蹈",
            "v": "美女舞蹈"
        },
        {
            "n": "牛仔裤",
            "v": "牛仔裤"
        },
        {
            "n": "黑丝",
            "v": "黑丝"
        },
        {
            "n": "超短裤",
            "v": "超短裤"
        },
        {
            "n": "超短裙",
            "v": "超短裙"
        },
        {
            "n": "舞蹈综合",
            "v": "舞蹈综合"
        },
        {
            "n": "舞蹈教程",
            "v": "舞蹈教程"
        }]
    },
    { "key": "duration", "name": "时长", "value": [
    { "n": "全部", "v": "0" },
    { "n": "60分钟以上", "v": "4" },
    { "n": "30~60分钟", "v": "3" },
    { "n": "10~30分钟", "v": "2" },
    { "n": "10分钟以下", "v": "1"  }]
    }],
    "女团 4K": [{
        "key": "tid",
        "name": "女团",
        "value": [{
            "n": "全部",
            "v": "女团 MV 合集"
        }]
    },
    {
        "key": "tid",
        "name": "中国女团",
        "value": [{
            "n": "SNH48",
            "v": "SNH48 MV 合集"
        },
        {
            "n": "S.H.E",
            "v": "S.H.E MV 合集"
        },
        {
            "n": "Twins",
            "v": "Twins MV 合集"
        },
        {
            "n": "火箭少女101",
            "v": "火箭少女101 MV 合集"
        },
        {
            "n": "BY2",
            "v": "BY2 MV 合集"
        },
        {
            "n": "S.I.N.G",
            "v": "S.I.N.G MV 合集"
        },
        {
            "n": "3unshine",
            "v": "3unshine MV 合集"
        },
        {
            "n": "蜜蜂少女队",
            "v": "蜜蜂少女队 MV 合集"
        },
        {
            "n": "七朵组合",
            "v": "七朵组合 MV 合集"
        },
        {
            "n": "GNZ48",
            "v": "GNZ48 MV 合集"
        }]
    },
    {
        "key": "tid",
        "name": "韩国女团",
        "value": [{
            "n": "全部",
            "v": "韩国女团 MV 合集"
        },
        {
            "n": "TWICE",
            "v": "TWICE MV 合集"
        },
        {
            "n": "4MINUTE",
            "v": "4MINUTE MV 合集"
        },
        {
            "n": "EXID",
            "v": "EXID MV 合集"
        },
        {
            "n": "KARA",
            "v": "KARA MV 合集"
        },
        {
            "n": "TARA",
            "v": "TARA MV 合集"
        },
        {
            "n": "BLACKPINK",
            "v": "BLACKPINK MV 合集"
        },
        {
            "n": "LOONA",
            "v": "LOONA MV 合集"
        },
        {
            "n": "ITZY",
            "v": "ITZY MV 合集"
        },
        {
            "n": "Red Velvet",
            "v": "Red Velvet MV 合集"
        },
        {
            "n": "Everglow",
            "v": "Everglow MV 合集"
        },
        {
            "n": "Mamamoo",
            "v": "Mamamoo MV 合集"
        },
        {
            "n": "少女时代",
            "v": "少女时代 MV 合集"
        },
        {
            "n": "S.E.S",
            "v": "S.E.S MV 合集"
        },
        {
            "n": "FIN.K.L",
            "v": "FIN.K.L MV 合集"
        },
        {
            "n": "2NE1",
            "v": "2NE1 MV 合集"
        },
        {
            "n": "Wonder Girls",
            "v": "Wonder Girls MV 合集"
        },
        {
            "n": "IZ*ONE",
            "v": "IZ*ONE MV 合集"
        },
        {
            "n": "Sistar",
            "v": "Sistar MV 合集"
        },
        {
            "n": "Apink",
            "v": "Apink MV 合集"
        },
        {
            "n": "AOA",
            "v": "AOA MV 合集"
        },
        {
            "n": "GFRIEND",
            "v": "GFRIEND MV 合集"
        },
        {
            "n": "f(x)",
            "v": "f(x) MV 合集"
        },
        {
            "n": "(G)I-DLE",
            "v": "(G)I-DLE MV 合集"
        },
        {
            "n": "Itzy",
            "v": "Itzy MV 合集"
        },
        {
            "n": "Oh! GG",
            "v": "Oh! GG MV 合集"
        },
        {
            "n": "GirlCrush",
            "v": "GirlCrush MV 合集"
        }]
    },
    {
        "key": "tid",
        "name": "日本女团",
        "value": [{
            "n": "全部",
            "v": "日本女团 MV 合集"
        },
        {
            "n": "AKB48",
            "v": "AKB48 MV 合集"
        },
        {
            "n": "SKE48",
            "v": "SKE48 MV 合集"
        },
        {
            "n": "NMB48",
            "v": "NMB48 MV 合集"
        },
        {
            "n": "JKT48",
            "v": "JKT48 MV 合集"
        },
        {
            "n": "HKT48",
            "v": "HKT48 MV 合集"
        },
        {
            "n": "AKB48 Team TP",
            "v": "AKB48 Team TP MV 合集"
        },
        {
            "n": "Perfume",
            "v": "Perfume MV 合集"
        },
        {
            "n": "桃色幸运草Z",
            "v": "桃色幸运草Z MV 合集"
        },
        {
            "n": "乃木坂46乃",
            "v": "乃木坂46乃 MV 合集"
        },
        {
            "n": "樱坂46",
            "v": "樱坂46 MV 合集"
        },
        {
            "n": "日向坂46",
            "v": "日向坂46 MV 合集"
        },
        {
            "n": "E-girls",
            "v": "E-girls MV 合集"
        },
        {
            "n": "NiziU",
            "v": "NiziU MV 合集"
        },
        {
            "n": "BiSH",
            "v": "BiSH MV 合集"
        },
        {
            "n": "早安少女组",
            "v": "早安少女组 MV 合集"
        }]
    },
    {
        "key": "duration",
        "name": "时长",
        "value": [{
            "n": "全部",
            "v": "0"
        },
        {
            "n": "60分钟以上",
            "v": "4"
        },
        {
            "n": "30~60分钟",
            "v": "3"
        },
        {
            "n": "10~30分钟",
            "v": "2"
        },
        {
            "n": "10分钟以下",
            "v": "1"
        }]
    }]
    },
    detailUrl:'/x/web-interface/view?aid=fyid',//二级详情拼接链接(json格式用)
    searchUrl:'/x/web-interface/search/type?search_type=video&keyword=**&page=1',
    searchable:2,
    quickSearch:0,
    headers:{
        "User-Agent":"PC_UA",
        "Referer": "https://www.bilibili.com",
        //"Cookie":"$bili_cookie"
        "Cookie":"http://127.0.0.1:9978/file/tvbox/bilicookie.txt"
    },
    timeout:5000,
    limit:8,
    play_parse:true,
    lazy:"js:let ids=input.split('_');let result={};let iurl='https://api.bilibili.com:443/x/player/playurl?avid='+ids[0]+'&cid='+ids[1]+'&qn=116';let html=request(iurl);let jRoot=JSON.parse(html);let jo=jRoot['data'];let ja=jo['durl'];let maxSize=-1;let position=-1;ja.forEach(function(tmpJo,i){if(maxSize<Number(tmpJo['size'])){maxSize=Number(tmpJo['size']);position=i}});let purl='';if(ja.length>0){if(position===-1){position=0}purl=ja[position]['url']}result['parse']=0;result['playUrl']='';result['url']=unescape(purl);result['header']={Referer:'https://live.bilibili.com','User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'};result['contentType']='video/x-flv';input=result",
    double:false,
    推荐:'*',
    // 一级:'js:let html=request(input);let msg=JSON.parse(html).message;function title_rep(title){if(/keyword/.test(title)){title=title.replace(\'<em class="keyword">\',"").replace("</em>","").replace("&quot;","\'");log("名称替换👉"+title)};return title}if(msg!=="0"){VODS=[{vod_name:KEY+"➢"+msg,vod_id:"no_data",vod_remarks:"别点,缺少bili_cookie",vod_pic:"https://ghproxy.com/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg"}]}else{let videos=[];let vodList=JSON.parse(html).data.result;vodList.forEach(function(vod){let aid=vod["aid"];let title=vod["title"].trim();title=title_rep(title);title=title_rep(title);title=title_rep(title);title=title_rep(title);let img="https:"+vod["pic"];let remark=vod["duration"];videos.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})});VODS=videos}',
    一级:'js:let html=request(input);function title_rep(title){if(/keyword/.test(title)){title=title.replace(\'<em class="keyword">\',"").replace("</em>","");log("名称替换👉"+title)};return title}function turnDHM(duration){let min=duration.split(":")[0];let sec=duration.split(":")[1];if(min==0){return sec+"秒"}else if(0<min&&min<60){return min+"分"}else if(60<=min&&min<1440){if(min%60==0){let h=min/60;return h+"小时"}else{let h=min/60;h=(h+"").split(".")[0];let m=min%60;return h+"小时"+m+"分"}}else if(min>=1440){let d=min/60/24;d=(d+"").split(".")[0];let h=min/60%24;h=(h+"").split(".")[0];let m=min%60;let dhm="";if(d>0){dhm=d+"天"}if(h>=1){dhm=dhm+h+"小时"}if(m>0){dhm=dhm+m+"分"}return dhm}return null}let videos=[];let vodList=JSON.parse(html).data.result;vodList.forEach(function(vod){let aid=vod["aid"];let title=vod["title"].trim().replace("&quot;","\'");title=title_rep(title);title=title_rep(title);title=title_rep(title);let img="https:"+vod["pic"];let remark=turnDHM(vod["duration"]);videos.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})});VODS=videos',
    二级:'js:let html=request(input);let jo=JSON.parse(html).data;let aid=jo["aid"];let title=jo["title"].replace(\'<em class="keyword">\',"").replace("</em>","");let pic=jo["pic"];let desc=jo["desc"];let year=jo["pubdate"];let dire=jo["owner"]["name"];let typeName=jo["tname"];let remark=jo["duration"];let vod={vod_id:aid,vod_name:title,vod_pic:pic,type_name:typeName,vod_year:year,vod_area:"bilidanmu",vod_remarks:remark,vod_tags:"mv",vod_director:dire,vod_content:desc};let ja=jo["pages"];let playurls=[];ja.forEach(function(tmpJo){let cid=tmpJo["cid"];let part=tmpJo["part"].replace("#","﹟").replace("$","﹩");playurls.push(part+"$"+aid+"_"+cid)});let playUrl=playurls.join("#");vod["vod_play_from"]="B站";vod["vod_play_url"]=playUrl;VOD=vod;',
    搜索:'*',
    预处理:'if(rule_fetch_params.headers.Cookie.startsWith("http")){rule_fetch_params.headers.Cookie=fetch(rule_fetch_params.headers.Cookie);setItem(RULE_CK,cookie)};log(rule_fetch_params.headers.Cookie)',
}