芒果二级.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. js:
  2. // log(input);
  3. fetch_params.headers.Referer = 'https://www.mgtv.com';
  4. fetch_params.headers['User-Agent'] = UA;
  5. pdfh = jsp.pdfh;
  6. pdfa = jsp.pdfa;
  7. pd = jsp.pd;
  8. VOD = {};
  9. let d = [];
  10. let html = request(input);
  11. let json = JSON.parse(html);
  12. let host = 'https://www.mgtv.com';
  13. let ourl = json.data.list.length>0?json.data.list[0].url:json.data.series[0].url;
  14. if(!/^http/.test(ourl)){
  15. ourl = host+ourl
  16. }
  17. // print(ourl);
  18. fetch_params.headers['User-Agent'] = MOBILE_UA;
  19. html = request(ourl);
  20. if(html.includes('window.location =')){
  21. print('开始获取ourl');
  22. ourl = pdfh(html,'meta[http-equiv=refresh]&&content').split('url=')[1];
  23. print('获取到ourl:'+ourl);
  24. html = request(ourl);
  25. }
  26. //影片信息
  27. try{
  28. // print(html);
  29. let details = pdfh(html, '.m-details&&Html').replace(/h1>/,'h6>').replace(/div/g, 'br');//详情网页
  30. print(details);
  31. let actor='',director='',time='';
  32. if (/播出时间/.test(details)) {
  33. actor = pdfh(html, 'p:eq(5)&&Text').substr(0,25);
  34. director = pdfh(html, 'p:eq(4)&&Text');
  35. time = pdfh(html, 'p:eq(3)&&Text');
  36. }else{
  37. actor = pdfh(html, 'p:eq(4)&&Text').substr(0,25);
  38. director = pdfh(html, 'p:eq(3)&&Text');
  39. time = '已完结';
  40. }
  41. let _img = pd(html,'.video-img&&img&&src');
  42. let JJ = pdfh(html,'.desc&&Text').split("简介:")[1];//简介
  43. let _desc = time;//更新,时间
  44. VOD.vod_name = pdfh(html, '.vt-txt&&Text');
  45. VOD.type_name = pdfh(html, 'p:eq(0)&&Text').substr(0,6);
  46. VOD.vod_area = pdfh(html, 'p:eq(1)&&Text');
  47. VOD.vod_actor = actor;
  48. VOD.vod_director = director;
  49. VOD.vod_remarks = _desc;
  50. VOD.vod_pic = _img;
  51. VOD.vod_content = JJ;
  52. }catch(e){
  53. log('获取影片信息发生错误:'+e.message);
  54. }
  55. // print(VOD);
  56. function getRjpg(imgUrl,xs){
  57. xs = xs||3;
  58. let picSize = /jpg_/.test(imgUrl)?imgUrl.split('jpg_')[1].split('.')[0]:false;
  59. let rjpg = false;
  60. if(picSize){
  61. let a = parseInt(picSize.split('x')[0])*xs;
  62. let b = parseInt(picSize.split('x')[1])*xs;
  63. rjpg = a+'x'+b+'.jpg';
  64. }
  65. let img = /jpg_/.test(imgUrl)&&rjpg?imgUrl.replace(imgUrl.split('jpg_')[1],rjpg):imgUrl;
  66. return img
  67. }
  68. // log(json.data.total+","+json.data.list.length);
  69. if (json.data.total === 1 && json.data.list.length===1) {
  70. let data= json.data.list[0];
  71. let url = 'https://www.mgtv.com' + data.url;
  72. d.push({
  73. title: data.t4,
  74. desc: data.t2,
  75. pic_url:getRjpg(data.img),
  76. url: url,
  77. });
  78. } else if(json.data.list.length>1){
  79. for (let i = 1; i <= json.data.total_page; i++) {
  80. if (i > 1) {
  81. json = JSON.parse(fetch(input.replace('page=1', 'page=' + i), {}));
  82. }
  83. json.data.list.forEach(function (data){
  84. let url = 'https://www.mgtv.com' + data.url;
  85. if (data.isIntact == '1') {
  86. d.push({
  87. title: data.t4,
  88. desc: data.t2,
  89. pic_url: getRjpg(data.img),
  90. url: url,
  91. });
  92. }
  93. });
  94. }
  95. }else{
  96. print(input+'暂无片源');
  97. }
  98. VOD.vod_play_from = 'mgtv';
  99. VOD.vod_play_url = d.map(function (it){
  100. return it.title + '$' + it.url;
  101. }).join('#');
  102. setResult(d);