dj0898_book_open.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * @File : dj0898_book_open.js.js
  3. * @Author : jade
  4. * @Date : 2023/12/22 17:00
  5. * @Email : jadehh@1ive.com
  6. * @Software : Samples
  7. * @Desc :
  8. */
  9. import {_} from '../lib/cat.js';
  10. import {Spider} from "./spider.js";
  11. import {BookShort} from "../lib/book.js";
  12. class DJ0898Spider extends Spider {
  13. constructor() {
  14. super();
  15. this.siteUrl = "http://m.dj0898.com";
  16. }
  17. getName() {
  18. return "🎵┃世纪DJ音乐网┃🎵"
  19. }
  20. getAppName() {
  21. return "世纪DJ音乐网"
  22. }
  23. getJSName() {
  24. return "dj0898_book_open"
  25. }
  26. getType() {
  27. return 10
  28. }
  29. async parseVodShortListFromDoc($) {
  30. let books = []
  31. const list = $("ul.djddv_djList > li");
  32. for (const it of list) {
  33. let bookShort = new BookShort();
  34. const a = $(it).find("a")[1];
  35. bookShort.book_id = a.attribs.href
  36. bookShort.book_pic = $(it).find("img:first")[0].attribs.src;
  37. const tt = $(it).find("strong:first")[0];
  38. bookShort.book_name = tt.children[0].data
  39. bookShort.book_remarks = "🎵" + $(it).find("font")[5].children[0].data || ""
  40. books.push(bookShort)
  41. }
  42. return books
  43. }
  44. async parseVodShortListFromDocByCategory($) {
  45. const list = $("ul.djddv_djList > li");
  46. let videos = _.map(list, (it) => {
  47. const a = $(it).find("a")[1];
  48. const img = $(it).find("img:first")[0];
  49. const tt = $(it).find("strong:first")[0];
  50. const remarks = $(it).find("font")[5];
  51. return {
  52. book_id: a.attribs.href,
  53. book_name: tt.children[0].data,
  54. book_pic: img.attribs["src"],
  55. book_remarks: "🎵" + remarks.children[0].data || "",
  56. };
  57. });
  58. const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
  59. this.page = hasMore ? parseInt(this.page) + 1 : parseInt(this.page);
  60. return videos
  61. }
  62. async parseVodShortListFromDocBySearch($) {
  63. const list = $("ul.djddv_djList > li");
  64. return _.map(list, (it) => {
  65. const a = $(it).find("a")[1];
  66. const img = $(it).find("img:first")[0];
  67. const tt = $(it).find("strong:first")[0];
  68. const remarks = $(it).find("font:first")[0];
  69. return {
  70. book_id: a.attribs.href,
  71. book_name: tt.children[0].data,
  72. book_pic: img.attribs["src"],
  73. book_remarks: "🎵" + remarks.children[0].data || "",
  74. };
  75. })
  76. }
  77. async parseVodDetailFromDoc(id) {
  78. const vod = {
  79. book_id: id,
  80. audio: 1,
  81. type_name: '',
  82. book_year: '',
  83. book_area: '',
  84. book_remarks: '',
  85. book_actor: '',
  86. book_director: '',
  87. book_content: '',
  88. };
  89. const playlist = ["点击播放" + "$" + vod.book_id];
  90. vod.volumes = "世纪DJ音乐网";
  91. vod.urls = playlist.join("#");
  92. return vod
  93. }
  94. async setClasses() {
  95. this.classes = [{type_id: 1, type_name: "🎧串烧舞曲"}, {type_id: 2, type_name: "🎧外文舞曲"}, {
  96. type_id: 3,
  97. type_name: "🎧早场暖场"
  98. }, {type_id: 4, type_name: "🎧中文舞曲"}, {type_id: 5, type_name: "🎧其他舞曲"}, {
  99. type_id: 6,
  100. type_name: "🎧国外电音"
  101. }, {type_id: 8, type_name: "🎧慢歌连版"}, {type_id: 9, type_name: "🎧酒吧潮歌"}, {
  102. type_id: 10,
  103. type_name: "🎧中文串烧"
  104. }, {type_id: 11, type_name: "🎧外文串烧"}, {type_id: 12, type_name: "🎧中外串烧"}, {
  105. type_id: 13,
  106. type_name: "🎧车载串烧"
  107. }, {type_id: 14, type_name: "🎧越鼓串烧"}, {type_id: 40, type_name: "🎧3D/环绕"}, {
  108. type_id: 45,
  109. type_name: "🎧口水旋律"
  110. }, {type_id: 46, type_name: "🎧精品收藏"}, {type_id: 47, type_name: "🎧开场舞曲"}, {
  111. type_id: 48,
  112. type_name: "🎧印度舞曲"
  113. }, {type_id: 49, type_name: "🎧编排套曲"}, {type_id: 20, type_name: "🎧DuTch"}, {
  114. type_id: 21,
  115. type_name: "🎧Mash up"
  116. }, {type_id: 22, type_name: "🎧ClubHouse"}, {type_id: 23, type_name: "🎧ElectroHouse"}, {
  117. type_id: 24,
  118. type_name: "🎧越南鼓Dj"
  119. }, {type_id: 30, type_name: "🎧Funky"}, {type_id: 31, type_name: "🎧Reggae"}, {
  120. type_id: 32,
  121. type_name: "🎧Rnb"
  122. }, {type_id: 33, type_name: "🎧Hip Hop"}, {type_id: 34, type_name: "🎧Dubstep"}, {
  123. type_id: 8017,
  124. type_name: "🎧Hardstyle"
  125. }, {type_id: 8018, type_name: "🎧Hands Up"}];
  126. }
  127. async setFilterObj() {
  128. }
  129. async setHomeVod() {
  130. let $ = await this.getHtml(this.siteUrl + "/dance/lists/id/10/1")
  131. this.homeVodList = await this.parseVodShortListFromDoc($)
  132. }
  133. async setCategory(tid, pg, filter, extend) {
  134. const link = this.siteUrl + "/dance/lists/id/" + tid + "/" + pg;
  135. let $ = await this.getHtml(link)
  136. this.vodList = await this.parseVodShortListFromDocByCategory($)
  137. }
  138. async setDetail(id) {
  139. this.vodDetail = await this.parseVodDetailFromDoc(id);
  140. }
  141. async setPlay(flag, id, flags) {
  142. let $ = await this.getHtml(id)
  143. const audio = $("body audio[src*=http]");
  144. this.playUrl = audio[0].attribs.src
  145. }
  146. async setSearch(wd, quick) {
  147. let $ = await this.getHtml(this.siteUrl + "/index.php/dance/so/key?key=" + wd + "&cid=0&p=1")
  148. this.vodList = await this.parseVodShortListFromDocBySearch($)
  149. }
  150. }
  151. let spider = new DJ0898Spider()
  152. async function init(cfg) {
  153. await spider.init(cfg)
  154. }
  155. async function home(filter) {
  156. return await spider.home(filter)
  157. }
  158. async function homeVod() {
  159. return await spider.homeVod()
  160. }
  161. async function category(tid, pg, filter, extend) {
  162. return await spider.category(tid, pg, filter, extend)
  163. }
  164. async function detail(id) {
  165. return await spider.detail(id)
  166. }
  167. async function play(flag, id, flags) {
  168. return await spider.play(flag, id, flags)
  169. }
  170. async function search(wd, quick) {
  171. return await spider.search(wd, quick)
  172. }
  173. async function proxy(segments, headers) {
  174. return await spider.proxy(segments, headers)
  175. }
  176. export function __jsEvalReturn() {
  177. return {
  178. init: init,
  179. home: home,
  180. homeVod: homeVod,
  181. category: category,
  182. detail: detail,
  183. play: play,
  184. search: search,
  185. proxy: proxy
  186. };
  187. }
  188. export {spider}