dj0898_book_open.js 6.0 KB

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