kuqimv_open.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // 修正:分类改静态 (网站频繁变动分类)
  2. import { load, _ } from "assets://js/lib/cat.js";
  3. let key = "酷奇MV";
  4. let HOST = "https://www.kuqimv.com";
  5. let siteKey = "";
  6. let siteType = 0;
  7. const PC_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36";
  8. async function request(reqUrl, referer, mth, data, hd) {
  9. const headers = {
  10. "User-Agent": PC_UA,
  11. };
  12. if (referer) headers.referer = encodeURIComponent(referer);
  13. let res = await req(reqUrl, {
  14. method: mth || "get",
  15. headers: headers,
  16. data: data,
  17. postType: mth === "post" ? "form" : "",
  18. });
  19. return res.content;
  20. }
  21. async function init(cfg) {
  22. siteKey = cfg.skey;
  23. siteType = cfg.stype;
  24. }
  25. async function home(filter) {
  26. var classes = [{ "type_id": "1", "type_name": "华语高清" }, { "type_id": "2", "type_name": "日韩精选" }, { "type_id": "3", "type_name": "欧美MV" }, { "type_id": "4", "type_name": "高清现场" }, { "type_id": "5", "type_name": "影视MV" }, { "type_id": "6", "type_name": "夜店视频" }, { "type_id": "7", "type_name": "车模视频" }, { "type_id": "8", "type_name": "热舞视频" }, { "type_id": "9", "type_name": "美女写真" }, { "type_id": "10", "type_name": "美女打碟" }];
  27. // const html = await request(HOST);
  28. // const $ = load(html);
  29. // const class_parse = $(".lei_fl > a[href*=play]");
  30. // const classes = [];
  31. // classes = _.map(class_parse, (cls) => {
  32. // const typeId = cls.attribs["href"];
  33. // typeId = typeId.substring(typeId.lastIndexOf("/") + 1).replace(".html", "");
  34. // return {
  35. // type_id: typeId,
  36. // type_name: cls.children[0].data,
  37. // };
  38. // });
  39. const filterObj = {};
  40. return JSON.stringify({
  41. class: _.map(classes, (cls) => {
  42. cls.land = 1;
  43. cls.ratio = 1.78;
  44. return cls;
  45. }),
  46. filters: filterObj,
  47. });
  48. }
  49. async function homeVod() {
  50. const link = HOST + "/play/9_1.html";
  51. const html = await request(link);
  52. const $ = load(html);
  53. const items = $("div.mv_list > li");
  54. let videos = _.map(items, (it) => {
  55. const a = $(it).find("a:first")[0];
  56. const img = $(it).find("img:first")[0];
  57. const singer = $($(it).find("div.singer")[0]).text().trim();
  58. const remarks = $($(it).find("span.lei_03")[0]).text().trim();
  59. return {
  60. vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
  61. vod_name: a.attribs.title,
  62. vod_pic: img.attribs["src"],
  63. vod_remarks: "🎤" + singer + "|" + remarks || "",
  64. };
  65. });
  66. return JSON.stringify({
  67. list: videos,
  68. });
  69. }
  70. async function category(tid, pg, filter, extend) {
  71. if (pg <= 0 || typeof pg == "undefined") pg = 1;
  72. const link = HOST + "/play/" + tid + "_" + pg + ".html";
  73. const html = await request(link);
  74. const $ = load(html);
  75. const items = $("div.mv_list > li");
  76. let videos = _.map(items, (it) => {
  77. const a = $(it).find("a:first")[0];
  78. const img = $(it).find("img:first")[0];
  79. const singer = $($(it).find("div.singer")[0]).text().trim();
  80. const remarks = $($(it).find("span.lei_03")[0]).text().trim();
  81. return {
  82. vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
  83. vod_name: a.attribs.title,
  84. vod_pic: img.attribs["src"],
  85. vod_remarks: "🎤" + singer + "|" + remarks || "",
  86. };
  87. });
  88. const hasMore = $("div.lei_page > a:contains(下一页)").length > 0;
  89. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  90. return JSON.stringify({
  91. page: parseInt(pg),
  92. pagecount: pgCount,
  93. limit: 24,
  94. total: 24 * pgCount,
  95. list: videos,
  96. });
  97. }
  98. async function detail(id) {
  99. const vod = {
  100. vod_id: id,
  101. vod_remarks: "",
  102. };
  103. const playlist = ["观看视频" + "$" + id];
  104. vod.vod_play_from = "道长在线";
  105. vod.vod_play_url = playlist.join("#");
  106. return JSON.stringify({
  107. list: [vod],
  108. });
  109. }
  110. async function play(flag, id, flags) {
  111. const link = HOST + "/skin/kuqimv/play.php";
  112. const ref = HOST + "/play/" + id + ".html";
  113. const pdata = { id: id };
  114. const playUrl = JSON.parse(await request(link, ref, "post", pdata)).url;
  115. const headers = {
  116. Referer: HOST,
  117. };
  118. return JSON.stringify({
  119. parse: 0,
  120. url: playUrl,
  121. header: headers,
  122. });
  123. }
  124. async function search(wd, quick, pg) {
  125. if (pg <= 0 || typeof pg == "undefined") pg = 1;
  126. const link = HOST + "/search.php?key=" + wd + "&pages=" + pg;
  127. const html = await request(link);
  128. const $ = load(html);
  129. const items = $("div.video_list > li");
  130. let videos = _.map(items, (it) => {
  131. const a = $(it).find("a:first")[0];
  132. const singer = $($(it).find("div.singer")[0]).text().trim();
  133. const remarks = $($(it).find("span.lei_04")[0]).text().trim();
  134. return {
  135. vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
  136. vod_name: a.attribs.title,
  137. vod_pic: "https://www.kuqimv.com/static/images/cover/singer.jpg",
  138. vod_remarks: "🎤" + singer + "|" + remarks || "",
  139. };
  140. });
  141. const hasMore = $("div.lei_page > a:contains(>)").length > 0;
  142. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  143. return JSON.stringify({
  144. page: parseInt(pg),
  145. pagecount: pgCount,
  146. limit: 20,
  147. total: 20 * pgCount,
  148. list: videos,
  149. land: 1,
  150. ratio: 1.78,
  151. });
  152. }
  153. export function __jsEvalReturn() {
  154. return {
  155. init: init,
  156. home: home,
  157. homeVod: homeVod,
  158. category: category,
  159. detail: detail,
  160. play: play,
  161. search: search,
  162. };
  163. }