360二级.js 3.2 KB
Newer Older
H
hjdhnx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
js:
// 请不要在里面使用单引号
// let html = fetch(input,fetch_params);
let html = JSON.parse(fetch(input,fetch_params));
let data = html.data;
// let tilte = jsp.pjfh(html,"data.title");
let tilte = data.title;
// let img = jsp.pj(html,"data.cdncover");
let img = data.cdncover;
// let vod_type = jsp.pjfa(html,"data.moviecategory").join(",");
let vod_type = data.moviecategory.join(",");
// let area = jsp.pjfa(html,"data.area").join(",");
let area = data.area.join(",");
// let director = jsp.pjfa(html,"data.director").join(",");
let director = data.director.join(",");
// let actor = jsp.pjfa(html,"data.actor").join(",");
let actor = data.actor.join(",");
// let content = jsp.pjfh(html,"data.description");
let content = data.description;
20
let base_vod = {
H
hjdhnx 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34
    vod_id:input,
    vod_name:tilte,
    type_name:vod_type,
    vod_actor:actor,
    vod_director:director,
    vod_content:content,
    vod_remarks:area,
    vod_pic:urljoin2(input,img),
    // vod_pic:img,
};
let delta = 200;
let vod_play = {};
// let sites = jsp.pjfa(html,"data.playlink_sites"); //data.playlinksdetail.#idv.quality
let sites = data.playlink_sites; //data.playlinksdetail.#idv.quality
35
sites.forEach(function (site){
H
hjdhnx 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    let playList = "";
    let vodItems = [];
    if(data.allupinfo){
        let total = parseInt(data.allupinfo[site]);
        // print('total:'+String(total));
        for(let j=1;j<total;j+=delta){
            let end = Math.min(total,j + delta-1);
            let url2 = buildUrl(input,{
                            "start": j,
                            "end": end,
                            "site": site
                        });
            // print(url2);
            let vod_data = JSON.parse(fetch(url2),fetch_params).data;
            if(vod_data.allepidetail){ //电视剧或者动漫
                vod_data = vod_data.allepidetail[site];
                vod_data.forEach(function(item,index) {
53
                    vodItems.push((item.playlink_num||"") + "$" + urlDeal(item.url||""));
H
hjdhnx 已提交
54 55 56 57
                });
            }else{// 综艺
                vod_data = vod_data.defaultepisode;
                vod_data.forEach(function(item,index) {
58
                    vodItems.push((item.period||"")+(item.name||"") + "$" + urlDeal(item.url)||"");
H
hjdhnx 已提交
59 60 61 62
                });
            }
        }
    }else{
63
        // print(data.playlinksdetail);
H
hjdhnx 已提交
64
        let item = data.playlinksdetail[site];
65
        vodItems.push((item.sort||"") + "$" +urlDeal(item.default_url||""));
H
hjdhnx 已提交
66 67 68 69 70 71
    }
    if(vodItems.length > 0){
       playList = vodItems.join("#");
    }
    // print(playList);
    if(playList.length < 1){
72
       return
H
hjdhnx 已提交
73 74
    }
    vod_play[site]=playList;
75
});
H
hjdhnx 已提交
76 77 78 79 80
// print(vod_play);
let tabs = Object.keys(vod_play);
// let playUrls = Object.values(vod_play); // 没法使用values方法和列表的join方法
let playUrls = [];
for(let id in tabs){
81
    print('id:'+id);
H
hjdhnx 已提交
82 83 84 85 86 87
    playUrls.push(vod_play[tabs[id]]);
}
// print(tabs);
// print(playUrls);
if(tabs.length>0){
   // vod_play_from = join(tabs,"$$$");
88
   let vod_play_from = tabs.join("$$$");
H
hjdhnx 已提交
89
   // vod_play_url = join(playUrls,"$$$");
90
   let vod_play_url = playUrls.join("$$$");
H
hjdhnx 已提交
91 92 93 94 95
   // print(vod_play_from);
   // print(vod_play_url);
   base_vod.vod_play_from = vod_play_from;
   base_vod.vod_play_url = vod_play_url;
}
96 97
VOD = base_vod;
// print(VOD);