芒果视频.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. var rule = {
  2. title: '百忙无果[官]',
  3. host: 'https://pianku.api.%6d%67%74%76.com',
  4. homeUrl: '',
  5. searchUrl: 'https://mobileso.bz.%6d%67%74%76.com/pc/search/v1?q=**&pn=fypage&pc=10',
  6. detailUrl: 'https://pcweb.api.mgtv.com/episode/list?page=1&size=50&video_id=fyid',
  7. searchable: 2,
  8. quickSearch: 0,
  9. filterable: 1,
  10. multi: 1,
  11. // 分类链接fypage参数支持1个()表达式
  12. // https://www.mgtv.com/lib/3?lastp=list_index&kind=a1&year=all&chargeInfo=a1&sort=c2
  13. url: '/rider/list/pcweb/v3?platform=pcweb&channelId=fyclass&pn=fypage&pc=80&hudong=1&_support=10000000&kind=a1&area=a1',
  14. filter_url: 'year={{fl.year or "all"}}&sort={{fl.sort or "all"}}&chargeInfo={{fl.chargeInfo or "all"}}',
  15. headers: {
  16. 'User-Agent': 'PC_UA'
  17. },
  18. timeout: 5000,
  19. class_name: '电视剧&电影&综艺&动漫&纪录片&教育&少儿',
  20. class_url: '2&3&1&50&51&115&10',
  21. filter: 'H4sIAAAAAAAAA+2XvUrDUBSA3+XOHc65adraN+jm5CIdYok/GFupWiilIBalIFYoIh1EBxEKIih0MOZ1msS+hbc1yTni4mKms6XfIbnnC/mG9hSq6mZP7btdVVWNXae949aa2y1VUE3nwDVsHkw+Z378FoT3l4Z2HO/EXd3SNMPwfLoYTJfY/HA8T/UL6eDK3JUMtjDjnb3DFOoMbtTW45tpOHxPR1Y2Sk4/86PxSzotqn59Of/e+ajVPqZto9E4/Lj+tWd0dxrdviYPaNA6hseD9MEN2ih+eJr7o8XzJBxepNOfx3Zdp03Hhv5sHjz+/fVo0MUEry4Zt4hbnGvimnMkjpwDcWAc1zJuLhmvEK9wXiZe5rxEvMS5TdzmnHyR+yL5IvdF8kXui+SL3BfJF7kvkC9wXyBf4L5AvsB9gXyB+wL5AvcF8oXVl1MvKC2pSWqSWh6pWZKapCap5ZGaDdKatCat5dKa/FuT1qS1XFpD80YkNolNYvv32PpfCLkneIcUAAA=',
  22. limit: 20,
  23. play_parse: true,
  24. // 手动调用解析请求json的url,此lazy不方便
  25. // lazy:'js:print(input);fetch_params.headers["user-agent"]=MOBILE_UA;let html=request(input);let rurl=html.match(/window\\.open\\(\'(.*?)\',/)[1];rurl=urlDeal(rurl);input={parse:1,url:rurl};',
  26. // 推荐:'.list_item;img&&alt;img&&src;a&&Text;a&&data-float',
  27. 一级: 'json:data.hitDocs;title;img;updateInfo||rightCorner.text;playPartId',
  28. // 一级:'json:data.hitDocs;title;img;updateInfo;playPartId',
  29. 二级: $js.toString(() => {
  30. fetch_params.headers.Referer = "https://www.mgtv.com";
  31. fetch_params.headers["User-Agent"] = UA;
  32. pdfh = jsp.pdfh;
  33. pdfa = jsp.pdfa;
  34. pd = jsp.pd;
  35. VOD = {};
  36. let d = [];
  37. let html = request(input);
  38. let json = JSON.parse(html);
  39. let host = "https://www.mgtv.com";
  40. let ourl = json.data.list.length > 0 ? json.data.list[0].url : json.data.series[0].url;
  41. if (!/^http/.test(ourl)) {
  42. ourl = host + ourl
  43. }
  44. fetch_params.headers["User-Agent"] = MOBILE_UA;
  45. html = request(ourl);
  46. if (html.includes("window.location =")) {
  47. print("开始获取ourl");
  48. ourl = pdfh(html, "meta[http-equiv=refresh]&&content").split("url=")[1];
  49. print("获取到ourl:" + ourl);
  50. html = request(ourl)
  51. }
  52. try {
  53. let details = pdfh(html, ".m-details&&Html").replace(/h1>/, "h6>").replace(/div/g, "br");
  54. print(details);
  55. let actor = "",
  56. director = "",
  57. time = "";
  58. if (/播出时间/.test(details)) {
  59. actor = pdfh(html, "p:eq(5)&&Text").substr(0, 25);
  60. director = pdfh(html, "p:eq(4)&&Text");
  61. time = pdfh(html, "p:eq(3)&&Text")
  62. } else {
  63. actor = pdfh(html, "p:eq(4)&&Text").substr(0, 25);
  64. director = pdfh(html, "p:eq(3)&&Text");
  65. time = "已完结"
  66. }
  67. let _img = pd(html, ".video-img&&img&&src");
  68. let JJ = pdfh(html, ".desc&&Text").split("简介:")[1];
  69. let _desc = time;
  70. VOD.vod_name = pdfh(html, ".vt-txt&&Text");
  71. VOD.type_name = pdfh(html, "p:eq(0)&&Text").substr(0, 6);
  72. VOD.vod_area = pdfh(html, "p:eq(1)&&Text");
  73. VOD.vod_actor = actor;
  74. VOD.vod_director = director;
  75. VOD.vod_remarks = _desc;
  76. VOD.vod_pic = _img;
  77. VOD.vod_content = JJ;
  78. if (!VOD.vod_name) {
  79. VOD.vod_name = VOD.type_name;
  80. }
  81. } catch (e) {
  82. log("获取影片信息发生错误:" + e.message)
  83. }
  84. function getRjpg(imgUrl, xs) {
  85. xs = xs || 3;
  86. let picSize = /jpg_/.test(imgUrl) ? imgUrl.split("jpg_")[1].split(".")[0] : false;
  87. let rjpg = false;
  88. if (picSize) {
  89. let a = parseInt(picSize.split("x")[0]) * xs;
  90. let b = parseInt(picSize.split("x")[1]) * xs;
  91. rjpg = a + "x" + b + ".jpg"
  92. }
  93. let img = /jpg_/.test(imgUrl) && rjpg ? imgUrl.replace(imgUrl.split("jpg_")[1], rjpg) : imgUrl;
  94. return img
  95. }
  96. if (json.data.total === 1 && json.data.list.length === 1) {
  97. let data = json.data.list[0];
  98. let url = "https://www.mgtv.com" + data.url;
  99. d.push({
  100. title: data.t4,
  101. desc: data.t2,
  102. pic_url: getRjpg(data.img),
  103. url: url
  104. })
  105. } else if (json.data.list.length > 1) {
  106. for (let i = 1; i <= json.data.total_page; i++) {
  107. if (i > 1) {
  108. json = JSON.parse(fetch(input.replace("page=1", "page=" + i), {}))
  109. }
  110. json.data.list.forEach(function (data) {
  111. let url = "https://www.mgtv.com" + data.url;
  112. if (data.isIntact == "1") {
  113. d.push({
  114. title: data.t4,
  115. desc: data.t2,
  116. pic_url: getRjpg(data.img),
  117. url: url
  118. })
  119. }
  120. })
  121. }
  122. } else {
  123. print(input + "暂无片源")
  124. }
  125. VOD.vod_play_from = "mgtv";
  126. VOD.vod_play_url = d.map(function (it) {
  127. return it.title + "$" + it.url
  128. }).join("#");
  129. setResult(d);
  130. }),
  131. 搜索: $js.toString(() => {
  132. fetch_params.headers.Referer = "https://www.mgtv.com";
  133. fetch_params.headers["User-Agent"] = UA;
  134. let d = [];
  135. let html = request(input);
  136. let json = JSON.parse(html);
  137. json.data.contents.forEach(function (data) {
  138. if (data.data.sourceList || data.data.yearList) {
  139. let list = data.data.sourceList ? data.data.sourceList : data.data.yearList[0].sourceList;
  140. let desc = "";
  141. list.forEach(function (it) {
  142. desc += it.name + "\t"
  143. });
  144. let fyclass = '';
  145. if (list[0].source === "imgo") {
  146. let img = data.data.pic ? data.data.pic : data.data.yearList[0].pic;
  147. try {
  148. fyclass = data.data.desc.find(it => it.label === '类型').url.match(/lib\/(\d+)/)[1] + '$';
  149. } catch (e) {
  150. fyclass = '';
  151. }
  152. log(fyclass);
  153. d.push({
  154. title: data.data.title ? data.data.title : data.data.yearList[0].title,
  155. img: img,
  156. content: data.data.story ? data.data.story : data.data.yearList[0].story,
  157. desc: data.data.playTime,
  158. url: fyclass + list[0].vid
  159. })
  160. }
  161. }
  162. });
  163. setResult(d);
  164. }),
  165. }