forked from qist/tvbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dj0898_open.js
156 lines (145 loc) · 5.9 KB
/
dj0898_open.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import { load, _ } from "assets://js/lib/cat.js";
let key = "世纪DJ音乐网";
let HOST = "http://m.dj0898.com";
let siteKey = "";
let siteType = 0;
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";
async function request(reqUrl, agentSp) {
let res = await req(reqUrl, {
method: "get",
headers: {
"User-Agent": agentSp || MOBILE_UA,
Referer: HOST,
},
});
return res.content;
}
async function init(cfg) {
siteKey = cfg.skey;
siteType = cfg.stype;
}
async function home(filter) {
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" }];
const filterObj = {};
return JSON.stringify({
class: _.map(classes, (cls) => {
cls.land = 1;
cls.ratio = 1.78;
return cls;
}),
filters: filterObj,
});
}
async function homeVod() {
const link = HOST + "/dance/lists/id/10/1";
const html = await request(link);
const $ = load(html);
const list = $("ul.djddv_djList > li");
let videos = _.map(list, (it) => {
const a = $(it).find("a")[1];
const img = $(it).find("img:first")[0];
const tt = $(it).find("strong:first")[0];
const remarks = $(it).find("font")[5];
return {
vod_id: a.attribs.href,
vod_name: tt.children[0].data,
vod_pic: img.attribs["src"],
vod_remarks: "🎵" + remarks.children[0].data || "",
};
});
return JSON.stringify({
list: videos,
});
}
async function category(tid, pg, filter, extend) {
if (pg <= 0 || typeof pg == "undefined") pg = 1;
const link = HOST + "/dance/lists/id/" + tid + "/" + pg;
const html = await request(link);
const $ = load(html);
const list = $("ul.djddv_djList > li");
let videos = _.map(list, (it) => {
const a = $(it).find("a")[1];
const img = $(it).find("img:first")[0];
const tt = $(it).find("strong:first")[0];
const remarks = $(it).find("font")[5];
return {
vod_id: a.attribs.href,
vod_name: tt.children[0].data,
vod_pic: img.attribs["src"],
vod_remarks: "🎵" + remarks.children[0].data || "",
};
});
const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
return JSON.stringify({
page: parseInt(pg),
pagecount: pgCount,
limit: 60,
total: 60 * pgCount,
list: videos,
});
}
async function detail(id) {
const vod = {
vod_id: id,
vod_remarks: "",
};
const playlist = ["点击播放" + "$" + vod.vod_id];
vod.vod_play_from = "道长在线";
vod.vod_play_url = playlist.join("#");
return JSON.stringify({
list: [vod],
});
}
async function play(flag, id, flags) {
const html = await request(id);
const $ = load(html);
const audio = $("body audio[src*=http]");
const audioUrl = audio[0].attribs.src;
// console.debug('世纪DJ音乐网 audioUrl =====>' + audioUrl); // js_debug.log
return JSON.stringify({
parse: 0,
url: audioUrl,
});
}
async function search(wd, quick, pg) {
if (pg <= 0 || typeof pg == "undefined") pg = 1;
const link = HOST + "/index.php/dance/so/key?key=" + wd + "&cid=0&p=" + pg;
const html = await request(link);
const $ = load(html);
const list = $("ul.djddv_djList > li");
let videos = _.map(list, (it) => {
const a = $(it).find("a")[1];
const img = $(it).find("img:first")[0];
const tt = $(it).find("strong:first")[0];
const remarks = $(it).find("font:first")[0];
return {
vod_id: a.attribs.href,
vod_name: tt.children[0].data,
vod_pic: img.attribs["src"],
vod_remarks: "🎵" + remarks.children[0].data || "",
};
});
const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
return JSON.stringify({
page: parseInt(pg),
pagecount: pgCount,
limit: 60,
total: 60 * pgCount,
list: videos,
land: 1,
ratio: 1.78,
});
}
export function __jsEvalReturn() {
return {
init: init,
home: home,
homeVod: homeVod,
category: category,
detail: detail,
play: play,
search: search,
};
}