哔哩一级.js 3.7 KB
Newer Older
H
hjdhnx 已提交
1 2 3
js:
let d = [];
function get_result(url){
H
hjdhnx 已提交
4
    let videos = [];
H
hjdhnx 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    let html = request(url);
    let jo = JSON.parse(html);
    if(jo['code'] === 0){
        let vodList = jo.result?jo.result.list:jo.data.list;
        vodList.forEach(function (vod){
            let aid = (vod['season_id']+'').trim();
            let title = vod['title'].trim();
            let img = vod['cover'].trim();
            let remark = vod['new_ep']['index_show'];
            videos.push({
                "vod_id": aid,
                "vod_name": title,
                "vod_pic": img,
                "vod_remarks": remark
            });
        });
    }
H
hjdhnx 已提交
22
    return videos;
H
hjdhnx 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
}
function get_rank(tid,pg){
    return get_result('https://api.bilibili.com/pgc/web/rank/list?season_type='+tid+'&pagesize=20&page='+pg+'&day=3')
}

function get_rank2(tid,pg){
    return get_result('https://api.bilibili.com/pgc/season/rank/web/list?season_type='+tid+'&pagesize=20&page='+pg+'&day=3')
}

function get_zhui(pg,mode){
    let url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type='+mode+'&follow_status=0&pn='+pg+'&ps=10&vmid='+getItem('userid','');
    return get_result(url)
}

function get_all(tid, pg, order, season_status){
    let url = 'https://api.bilibili.com/pgc/season/index/result?order='+order+'&pagesize=20&type=1&season_type='+tid+'&page='+pg+'&season_status='+season_status;
    return get_result(url)
}

function get_timeline(tid,pg){
H
hjdhnx 已提交
43
    let videos = [];
H
hjdhnx 已提交
44 45 46 47 48 49 50 51 52 53 54
    let url = 'https://api.bilibili.com/pgc/web/timeline/v2?season_type='+tid+'&day_before=2&day_after=4';
    let html = request(url);
    let jo = JSON.parse(html);
    if(jo['code'] === 0){
        let videos1 = [];
        let vodList = jo.result.latest;
        vodList.forEach(function (vod){
            let aid = (vod['season_id']+'').trim();
            let title = vod['title'].trim();
            let img = vod['cover'].trim();
            let remark = vod['pub_index'] + ' ' + vod['follows'].replace('系列', '');
H
hjdhnx 已提交
55
            videos1.push({
H
hjdhnx 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
                "vod_id": aid,
                "vod_name": title,
                "vod_pic": img,
                "vod_remarks": remark
            });
        });
        let videos2 = [];
        for(let i=0;i<7;i++){
            let vodList = jo['result']['timeline'][i]['episodes'];
            vodList.forEach(function (vod){
                if((vod['published']+'') === "0"){
                    let aid = (vod['season_id']+'').trim();
                    let title = vod['title'].trim();
                    let img = vod['cover'].trim();
                    let date = vod['pub_ts'];
                    let remark = date + "   " + vod['pub_index'];
                    videos2.push({
                            "vod_id": aid,
                            "vod_name": title,
                            "vod_pic": img,
                            "vod_remarks": remark
                    });
                }
            });
        }
H
hjdhnx 已提交
81
        videos = videos2.concat(videos1);
H
hjdhnx 已提交
82
    }
H
hjdhnx 已提交
83
    return videos;
H
hjdhnx 已提交
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
}

function cate_filter(d, cookie) {
    if (MY_CATE === "1") {
        return get_rank(MY_CATE,MY_PAGE)
    }else if(['2','3','4','5','7'].includes(MY_CATE)){
        return get_rank2(MY_CATE,MY_PAGE)
    }else if(MY_CATE==='全部'){
        let tid = MY_FL.tid||'1' ;
        let order = MY_FL.order||'2';
        let season_status = MY_FL.season_status||'-1';
        return get_all(tid, MY_PAGE, order, season_status)
    }else if(MY_CATE==='追番'){
        return get_zhui(MY_PAGE, 1)
    }else if(MY_CATE==='追剧'){
        return get_zhui(MY_PAGE, 2)
    }else if(MY_CATE==='时间表'){
        let tid = MY_FL.tid||'1' ;
        return get_timeline(tid,MY_PAGE)
    }else{
        return {}
    }
}
H
hjdhnx 已提交
107
VODS = cate_filter();
H
hjdhnx 已提交
108
// print(VODS);