芒果视频.js 7.7 KB

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