-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathpush_agent.js
316 lines (315 loc) · 16.3 KB
/
push_agent.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
const {getHtml} = $.require('./_lib.request.js')
const {
formatPlayUrl,
} = misc;
const aliTranscodingCache = {};
const aliDownloadingCache = {};
var rule = {
title: '推送',
host: '',
class_name: '推送',
class_url: 'push',
url: '',
play_parse: true,
一级: async function (tid, pg, filter, extend) {
let {MY_CATE, MY_PAGE, input} = this;
return []
},
二级: async function (ids) {
let {input, orId, publicUrl} = this;
let playform = []
let playurls = []
input = decodeURIComponent(orId);
let icon = urljoin(publicUrl, './images/icon_cookie/推送.jpg');
// log(input);
let vod = {
vod_pic: icon,
vod_id: orId,
vod_content: orId || '温馨提醒:宝子们,推送的时候记得确保ids存在哟~',
vod_name: 'DS推送:道长&秋秋倾情打造',
}
try {
let push_vod = JSON.parse(input);
push_vod = Array.isArray(push_vod) ? push_vod[0] : push_vod;
vod.vod_actor = push_vod.actor || push_vod.vod_actor || '';
vod.vod_content = push_vod.content || push_vod.vod_content || '';
vod.vod_director = push_vod.director || push_vod.vod_director || '';
vod.vod_play_from = push_vod.from || push_vod.vod_play_from || '';
vod.vod_name = push_vod.name || push_vod.vod_name || '';
vod.vod_pic = push_vod.pic || push_vod.vod_pic || '';
vod.vod_play_url = push_vod.url || push_vod.vod_play_url || '';
// 推送json兼容依赖播放属性
vod.vod_play_api = push_vod.vod_play_api || '';
return vod
} catch (e) {
}
if (input.indexOf('#')) {
let list = input.split('#');
log(list);
for (let i = 0; i < list.length; i++) {
if (/pan.quark.cn|drive.uc.cn|www.alipan.com/.test(list[i])) {
if (/pan.quark.cn/.test(list[i])) {
const shareData = Quark.getShareData(list[i]);
if (shareData) {
const videos = await Quark.getFilesByShareUrl(shareData);
if (videos.length > 0) {
playform.push('Quark-' + shareData.shareId);
playurls.push(videos.map((v) => {
const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
return v.file_name + '$' + list.join('*');
}).join('#'))
} else {
playform.push('Quark-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
if (/drive.uc.cn/.test(list[i])) {
const shareData = UC.getShareData(list[i]);
if (shareData) {
const videos = await UC.getFilesByShareUrl(shareData);
if (videos.length > 0) {
playform.push('UC-' + shareData.shareId);
playurls.push(videos.map((v) => {
const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
return v.file_name + '$' + list.join('*');
}).join('#'))
} else {
playform.push('UC-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
if (/www.alipan.com/.test(list[i])) {
const shareData = Ali.getShareData(list[i]);
if (shareData) {
const videos = await Ali.getFilesByShareUrl(shareData);
log(videos)
if (videos.length > 0) {
playform.push('Ali-' + shareData.shareId);
playurls.push(videos.map((v) => {
const ids = [v.share_id, v.file_id, v.subtitle ? v.subtitle.file_id : ''];
return formatPlayUrl('', v.name) + '$' + ids.join('*');
}).join('#'))
} else {
playform.push('Ali-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
} else {
playform.push('推送');
playurls.push("推送" + '$' + list[i])
}
}
} else if (/pan.quark.cn|drive.uc.cn|www.alipan.com/.test(input)) {
if (/pan.quark.cn/.test(input)) {
const shareData = Quark.getShareData(input);
if (shareData) {
const videos = await Quark.getFilesByShareUrl(shareData);
if (videos.length > 0) {
playform.push('Quark-' + shareData.shareId);
playurls.push(videos.map((v) => {
const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
return v.file_name + '$' + list.join('*');
}).join('#'))
} else {
playform.push('Quark-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
if (/drive.uc.cn/.test(input)) {
const shareData = UC.getShareData(link);
if (shareData) {
const videos = await UC.getFilesByShareUrl(shareData);
if (videos.length > 0) {
playform.push('UC-' + shareData.shareId);
playurls.push(videos.map((v) => {
const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
return v.file_name + '$' + list.join('*');
}).join('#'))
} else {
playform.push('UC-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
if (/www.alipan.com/.test(input)) {
const shareData = Ali.getShareData(link);
if (shareData) {
const videos = await Ali.getFilesByShareUrl(shareData);
log(videos)
if (videos.length > 0) {
playform.push('Ali-' + shareData.shareId);
playurls.push(videos.map((v) => {
const ids = [v.share_id, v.file_id, v.subtitle ? v.subtitle.file_id : ''];
return formatPlayUrl('', v.name) + '$' + ids.join('*');
}).join('#'))
} else {
playform.push('Ali-' + shareData.shareId);
playurls.push("资源已经失效,请访问其他资源")
}
}
}
}
// else if((typeof JSON.parse(input) === 'object'&& JSON.parse(input).url !=='')){
// let json = JSON.parse(input);
// let list = JSON.parse(input).url.split('#');
// vod = {
// vod_name: json.vod_name || '',
// vod_pic: json.vod_pic || '',
// vod_content: json.vod_content || '',
// vod_remarks: json.vod_remarks || '',
// }
// for (let i = 0; i < list.length; i++) {
// if(/pan.quark.cn|drive.uc.cn|www.alipan.com/.test(list[i])){
// if (/pan.quark.cn/.test(list[i])) {
// const shareData = Quark.getShareData(list[i]);
// if (shareData) {
// const videos = await Quark.getFilesByShareUrl(shareData);
// if (videos.length > 0) {
// playform.push('Quark-' + shareData.shareId);
// playurls.push(videos.map((v) => {
// const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
// return v.file_name + '$' + list.join('*');
// }).join('#'))
// } else {
// playform.push('Quark-' + shareData.shareId);
// playurls.push("资源已经失效,请访问其他资源")
// }
// }
// }
// if (/drive.uc.cn/.test(list[i])) {
// const shareData = UC.getShareData(list[i]);
// if (shareData) {
// const videos = await UC.getFilesByShareUrl(shareData);
// if (videos.length > 0) {
// playform.push('UC-' + shareData.shareId);
// playurls.push(videos.map((v) => {
// const list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
// return v.file_name + '$' + list.join('*');
// }).join('#'))
// } else {
// playform.push('UC-' + shareData.shareId);
// playurls.push("资源已经失效,请访问其他资源")
// }
// }
// }
// if (/www.alipan.com/.test(list[i])) {
// const shareData = Ali.getShareData(list[i]);
// if (shareData) {
// const videos = await Ali.getFilesByShareUrl(shareData);
// log(videos)
// if (videos.length > 0) {
// playform.push('Ali-' + shareData.shareId);
// playurls.push(videos.map((v) => {
// const ids = [v.share_id, v.file_id, v.subtitle ? v.subtitle.file_id : ''];
// return formatPlayUrl('', v.name) + '$' + ids.join('*');
// }).join('#'))
// } else {
// playform.push('Ali-' + shareData.shareId);
// playurls.push("资源已经失效,请访问其他资源")
// }
// }
// }
// }else {
// playform.push('推送');
// playurls.push("推送"+'$'+list[i])
// }
// }
// }
else {
playform.push('推送');
playurls.push("推送" + '$' + input)
}
vod.vod_play_from = playform.join("$$$")
vod.vod_play_url = playurls.join("$$$")
return vod
},
lazy: async function (flag, id, flags) {
let {input} = this;
if (flag === '推送') {
if (tellIsJx(input)) {
return {parse: 1, jx: 1, url: input}
} else if (/m3u8|mp4|m3u/.test(input)) {
return {url: input}
} else {
return {parse: 1, url: input}
}
} else if (/Quark-|UC-|Ali-/.test(flag)) {
const ids = input.split('*');
const urls = [];
let UCDownloadingCache = {};
let downUrl = ''
if (flag.startsWith('Quark-')) {
console.log("夸克网盘解析开始")
const down = await Quark.getDownload(ids[0], ids[1], ids[2], ids[3], true);
// urls.push("go原画代理",'http://127.0.0.1:7777/?thread=20&url='+down.download_url)
urls.push("原画", down.download_url + '#fastPlayMode##threads=10#')
const transcoding = (await Quark.getLiveTranscoding(ids[0], ids[1], ids[2], ids[3])).filter((t) => t.accessable);
transcoding.forEach((t) => {
urls.push(t.resolution === 'low' ? "流畅" : t.resolution === 'high' ? "高清" : t.resolution === 'super' ? "超清" : t.resolution, t.video_info.url)
});
return {
parse: 0,
url: urls,
header: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
'origin': 'https://pan.quark.cn',
'referer': 'https://pan.quark.cn/',
'Cookie': Quark.cookie
}
}
}
if (flag.startsWith('UC-')) {
console.log("UC网盘解析开始")
if (!UCDownloadingCache[ids[1]]) {
const down = await UC.getDownload(ids[0], ids[1], ids[2], ids[3], true);
if (down) UCDownloadingCache[ids[1]] = down;
}
downUrl = UCDownloadingCache[ids[1]].download_url;
urls.push("UC原画", downUrl);
return {
parse: 0,
url: urls,
header: {
"Referer": "https://drive.uc.cn/",
"cookie": UC.cookie,
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch'
},
}
}
if (flag.startsWith('Ali-')) {
const transcoding_flag = {
UHD: "4K 超清",
QHD: "2K 超清",
FHD: "1080 全高清",
HD: "720 高清",
SD: "540 标清",
LD: "360 流畅"
};
console.log("网盘解析开始")
const down = await Ali.getDownload(ids[0], ids[1], flag === 'down');
urls.push("原画", down.url + "#isVideo=true##ignoreMusic=true#")
urls.push("极速原画", down.url + "#fastPlayMode##threads=10#")
const transcoding = (await Ali.getLiveTranscoding(ids[0], ids[1])).sort((a, b) => b.template_width - a.template_width);
transcoding.forEach((t) => {
if (t.url !== '') {
urls.push(transcoding_flag[t.template_id], t.url);
}
});
return {
parse: 0,
url: urls,
header: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
'Referer': 'https://www.aliyundrive.com/',
},
}
}
} else {
return input
}
},
}