dj0898_book_open.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. import { load, _ } from "./lib/cat.js";
  2. let key = "世纪DJ音乐网_book";
  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. book_id: a.attribs.href,
  67. book_name: tt.children[0].data,
  68. book_pic: img.attribs["src"],
  69. book_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. book_id: id,
  85. type_name: '',
  86. book_year: '',
  87. book_area: '',
  88. book_remarks: '',
  89. book_actor: '',
  90. book_director: '',
  91. book_content: '',
  92. };
  93. const playlist = ["点击播放" + "$" + vod.book_id];
  94. vod.volumes = "道长在线";
  95. vod.urls = playlist.join("#");
  96. return JSON.stringify({
  97. list: [vod],
  98. });
  99. }
  100. async function play(flag, id, flags) {
  101. const html = await request(id);
  102. const $ = load(html);
  103. const audio = $("body audio[src*=http]");
  104. const audioUrl = audio[0].attribs.src;
  105. // console.debug('世纪DJ音乐网 audioUrl =====>' + audioUrl); // js_debug.log
  106. return JSON.stringify({
  107. parse: 0,
  108. url: audioUrl,
  109. });
  110. }
  111. async function search(wd, quick, pg) {
  112. if (pg <= 0 || typeof pg == "undefined") pg = 1;
  113. const link = HOST + "/index.php/dance/so/key?key=" + wd + "&cid=0&p=" + pg;
  114. const html = await request(link);
  115. const $ = load(html);
  116. const list = $("ul.djddv_djList > li");
  117. let videos = _.map(list, (it) => {
  118. const a = $(it).find("a")[1];
  119. const img = $(it).find("img:first")[0];
  120. const tt = $(it).find("strong:first")[0];
  121. const remarks = $(it).find("font:first")[0];
  122. return {
  123. book_id: a.attribs.href,
  124. book_name: tt.children[0].data,
  125. book_pic: img.attribs["src"],
  126. book_remarks: "🎵" + remarks.children[0].data || "",
  127. };
  128. });
  129. const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
  130. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  131. return JSON.stringify({
  132. page: parseInt(pg),
  133. pagecount: pgCount,
  134. limit: 60,
  135. total: 60 * pgCount,
  136. list: videos,
  137. land: 1,
  138. ratio: 1.78,
  139. });
  140. }
  141. export function __jsEvalReturn() {
  142. return {
  143. init: init,
  144. home: home,
  145. homeVod: homeVod,
  146. category: category,
  147. detail: detail,
  148. play: play,
  149. search: search,
  150. };
  151. }