爱奇艺二级.js 3.4 KB
Newer Older
H
hjdhnx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
js:
let d = [];
let html = request(input);
let json = JSON.parse(html).data;
vod = {
    vod_id:'',
    vod_url:input,
    vod_name:'',
    type_name:'',
    vod_actor:'',
    vod_year:'',
    vod_director:'',
    vod_area:'',
    vod_content:'',
    vod_remarks:'',
    vod_pic:'',
};
vod.vod_name = json.name;
try {
    if (json.latestOrder) {
        vod.vod_remarks = "类型: " + (json.categories[0].name || "") + "\t" + (json.categories[1].name || "") + "\t" + (json.categories[2].name || "") + "\t" + '评分:' + (json.score || "") + "\n更新至:第" + json.latestOrder + "集(期)/共" + json.videoCount + "集(期)";
    } else {
        vod.vod_remarks = "类型: " + (json.categories[0].name || "") + "\t" + (json.categories[1].name || "") + "\t" + (json.categories[2].name || "") + "\t" + '评分:' + (json.score || "") + json.period;
    }
} catch (e) {
    vod.vod_remarks = json.subtitle;
}
vod.vod_area = (json.focus || "") + "\n资费:" + (json.payMark === 1 ? "VIP" : "免费") + "\n地区:" + ((json.areas) || "");
let vsize = '579_772'
try {
    vsize = json.imageSize[12];
}catch (e) {}
vod.vod_pic =  json.imageUrl.replace('.jpg', ('_'+vsize+'.jpg?caplist=jpg,webp'));
// print(vod.vod_pic);
vod.type_name =  json.categories.map(function (it){return it.name}).join(',');
if(json.people.main_charactor){
    vod_actors = [];
    json.people.main_charactor.forEach(function (it){
        vod_actors.push(it.name);
    });
    vod.vod_actor = vod_actors.join(',')
}
vod.vod_content = json.description;
let playlists = []
if (json.channelId === 1 || json.channelId === 5) {
    playlists = [{
        "playUrl": json.playUrl,
        "imageUrl": json.imageUrl,
        //"subtitle": json.subtitle,
        "shortTitle": json.shortTitle,
        "focus": json.focus,
        "period": json.period
    }]
} else {
    if (json.channelId === 6) {
        let qs = json.period.split('-')[0];
        let listUrl = "https://pcw-api.iqiyi.com/album/source/svlistinfo?cid=6&sourceid=" + json.albumId + "&timelist=" + qs;
        // print(listUrl);
        let playData = JSON.parse(request(listUrl)).data[qs];
        playData.forEach(function (it){
            playlists.push({
                "playUrl": it.playUrl,
                "imageUrl": it.imageUrl,
                //"subtitle": it.subtitle,
                "shortTitle": it.shortTitle,
                "focus": it.focus,
                "period": it.period
            })
        });
    } else {
        let listUrl = 'https://pcw-api.iqiyi.com/albums/album/avlistinfo?aid=' + json.albumId + '&size=200&page=1';
        let data = JSON.parse(request(listUrl)).data;
        let total = data.total;
        playlists = data.epsodelist;
        if(total>200){
            for(let i=2;i<(total/200)+1;i++){
                let listUrl = 'https://pcw-api.iqiyi.com/albums/album/avlistinfo?aid=' + json.albumId + '&size=200&page='+i;
                let data = JSON.parse(request(listUrl)).data;
                playlists = playlists.concat(data.epsodelist);
            }
        }
        //log(listUrl)
    }
}
playlists.forEach(function (it){
    d.push({
            title: (it.shortTitle) || ('' + it.order + ''),
            desc: it.subtitle || it.focus || it.period,
            img: it.imageUrl.replace('.jpg', '_480_270.jpg?caplist=jpg,webp'),
            url: it.playUrl,
    });
});
vod.vod_play_from = 'qiyi';
vod.vod_play_url = d.map(function (it){
    return it.title + '$' + it.url;
}).join('#');