dj0898_open.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import { load, _ } from "assets://js/lib/cat.js";
  2. let key = "世纪DJ音乐网";
  3. let HOST = "http://m.dj0898.com";
  4. let siteKey = "";
  5. let siteType = 0;
  6. const MOBILE_UA = "Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36";
  7. async function request(reqUrl, agentSp) {
  8. let res = await req(reqUrl, {
  9. method: "get",
  10. headers: {
  11. "User-Agent": agentSp || MOBILE_UA,
  12. Referer: HOST,
  13. },
  14. });
  15. return res.content;
  16. }
  17. async function init(cfg) {
  18. siteKey = cfg.skey;
  19. siteType = cfg.stype;
  20. }
  21. async function home(filter) {
  22. const classes = [{ type_id: 1, type_name: "🎧串烧舞曲" }, { type_id: 2, type_name: "🎧外文舞曲" }, { type_id: 3, type_name: "🎧早场暖场" }, { type_id: 4, type_name: "🎧中文舞曲" }, { type_id: 5, type_name: "🎧其他舞曲" }, { type_id: 6, type_name: "🎧国外电音" }, { type_id: 8, type_name: "🎧慢歌连版" }, { type_id: 9, type_name: "🎧酒吧潮歌" }, { type_id: 10, type_name: "🎧中文串烧" }, { type_id: 11, type_name: "🎧外文串烧" }, { type_id: 12, type_name: "🎧中外串烧" }, { type_id: 13, type_name: "🎧车载串烧" }, { type_id: 14, type_name: "🎧越鼓串烧" }, { type_id: 40, type_name: "🎧3D/环绕" }, { type_id: 45, type_name: "🎧口水旋律" }, { type_id: 46, type_name: "🎧精品收藏" }, { type_id: 47, type_name: "🎧开场舞曲" }, { type_id: 48, type_name: "🎧印度舞曲" }, { type_id: 49, type_name: "🎧编排套曲" }, { type_id: 20, type_name: "🎧DuTch" }, { type_id: 21, type_name: "🎧Mash up" }, { type_id: 22, type_name: "🎧ClubHouse" }, { type_id: 23, type_name: "🎧ElectroHouse" }, { type_id: 24, type_name: "🎧越南鼓Dj" }, { type_id: 30, type_name: "🎧Funky" }, { type_id: 31, type_name: "🎧Reggae" }, { type_id: 32, type_name: "🎧Rnb" }, { type_id: 33, type_name: "🎧Hip Hop" }, { type_id: 34, type_name: "🎧Dubstep" }, { type_id: 8017, type_name: "🎧Hardstyle" }, { type_id: 8018, type_name: "🎧Hands Up" }];
  23. const filterObj = {};
  24. return JSON.stringify({
  25. class: _.map(classes, (cls) => {
  26. cls.land = 1;
  27. cls.ratio = 1.78;
  28. return cls;
  29. }),
  30. filters: filterObj,
  31. });
  32. }
  33. async function homeVod() {
  34. const link = HOST + "/dance/lists/id/10/1";
  35. const html = await request(link);
  36. const $ = load(html);
  37. const list = $("ul.djddv_djList > li");
  38. let videos = _.map(list, (it) => {
  39. const a = $(it).find("a")[1];
  40. const img = $(it).find("img:first")[0];
  41. const tt = $(it).find("strong:first")[0];
  42. const remarks = $(it).find("font")[5];
  43. return {
  44. vod_id: a.attribs.href,
  45. vod_name: tt.children[0].data,
  46. vod_pic: img.attribs["src"],
  47. vod_remarks: "🎵" + remarks.children[0].data || "",
  48. };
  49. });
  50. return JSON.stringify({
  51. list: videos,
  52. });
  53. }
  54. async function category(tid, pg, filter, extend) {
  55. if (pg <= 0 || typeof pg == "undefined") pg = 1;
  56. const link = HOST + "/dance/lists/id/" + tid + "/" + pg;
  57. const html = await request(link);
  58. const $ = load(html);
  59. const list = $("ul.djddv_djList > li");
  60. let videos = _.map(list, (it) => {
  61. const a = $(it).find("a")[1];
  62. const img = $(it).find("img:first")[0];
  63. const tt = $(it).find("strong:first")[0];
  64. const remarks = $(it).find("font")[5];
  65. return {
  66. vod_id: a.attribs.href,
  67. vod_name: tt.children[0].data,
  68. vod_pic: img.attribs["src"],
  69. vod_remarks: "🎵" + remarks.children[0].data || "",
  70. };
  71. });
  72. const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
  73. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  74. return JSON.stringify({
  75. page: parseInt(pg),
  76. pagecount: pgCount,
  77. limit: 60,
  78. total: 60 * pgCount,
  79. list: videos,
  80. });
  81. }
  82. async function detail(id) {
  83. const vod = {
  84. vod_id: id,
  85. vod_remarks: "",
  86. };
  87. const playlist = ["点击播放" + "$" + vod.vod_id];
  88. vod.vod_play_from = "道长在线";
  89. vod.vod_play_url = playlist.join("#");
  90. return JSON.stringify({
  91. list: [vod],
  92. });
  93. }
  94. async function play(flag, id, flags) {
  95. const html = await request(id);
  96. const $ = load(html);
  97. const audio = $("body audio[src*=http]");
  98. const audioUrl = audio[0].attribs.src;
  99. // console.debug('世纪DJ音乐网 audioUrl =====>' + audioUrl); // js_debug.log
  100. return JSON.stringify({
  101. parse: 0,
  102. url: audioUrl,
  103. });
  104. }
  105. async function search(wd, quick, pg) {
  106. if (pg <= 0 || typeof pg == "undefined") pg = 1;
  107. const link = HOST + "/index.php/dance/so/key?key=" + wd + "&cid=0&p=" + pg;
  108. const html = await request(link);
  109. const $ = load(html);
  110. const list = $("ul.djddv_djList > li");
  111. let videos = _.map(list, (it) => {
  112. const a = $(it).find("a")[1];
  113. const img = $(it).find("img:first")[0];
  114. const tt = $(it).find("strong:first")[0];
  115. const remarks = $(it).find("font:first")[0];
  116. return {
  117. vod_id: a.attribs.href,
  118. vod_name: tt.children[0].data,
  119. vod_pic: img.attribs["src"],
  120. vod_remarks: "🎵" + remarks.children[0].data || "",
  121. };
  122. });
  123. const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
  124. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  125. return JSON.stringify({
  126. page: parseInt(pg),
  127. pagecount: pgCount,
  128. limit: 60,
  129. total: 60 * pgCount,
  130. list: videos,
  131. land: 1,
  132. ratio: 1.78,
  133. });
  134. }
  135. export function __jsEvalReturn() {
  136. return {
  137. init: init,
  138. home: home,
  139. homeVod: homeVod,
  140. category: category,
  141. detail: detail,
  142. play: play,
  143. search: search,
  144. };
  145. }