360二级.js 3.2 KB

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