Skip to content

Commit 018972b

Browse files
author
Taois
committed
feat: 合并代码
1 parent 406ee60 commit 018972b

File tree

5 files changed

+216
-157
lines changed

5 files changed

+216
-157
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,4 @@ dist
151151
/binary/
152152
/plugins/
153153
/plugin.js
154+
/.claude

package.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {join, basename, dirname, resolve, relative} from 'path';
44
import url from 'url';
55

66
// 要排除的目录列表
7-
const EXCLUDE_DIRS = ['.git', '.idea', 'soft', 'binary', 'plugins', 'pyTools', 'drop_code', 'jstest', 'local', 'logs', '对话1.txt', 'vod_cache', 'data/mv'];
7+
const EXCLUDE_DIRS = ['.git', '.idea', 'soft', 'plugins/pvideo', 'plugins/req-proxy', 'pyTools', 'drop_code', 'jstest', 'local', 'logs', '对话1.txt', 'vod_cache', 'data/mv'];
88

99
// 要排除的文件列表
10-
const EXCLUDE_FILES = ['config/env.json', '.env', 'plugin.js', 'spider/js/UC分享.js', 'spider/js/百忙无果[官].js', 'json/UC分享.json', 'jx/奇奇.js', 'jx/芒果关姐.js', 'data/settings/link_data.json', 'index.json', 'custom.json'];
10+
const EXCLUDE_FILES = ['config/env.json', '.env', '.claude', 'plugin.js', 'spider/js/UC分享.js', 'spider/js/百忙无果[官].js', 'json/UC分享.json', 'jx/奇奇.js', 'jx/芒果关姐.js', 'data/settings/link_data.json', 'index.json', 'custom.json'];
1111

1212
// 获取脚本所在目录
1313
const getScriptDir = () => dirname(resolve(url.fileURLToPath(import.meta.url)));

package.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import re
55

66
# 要排除的目录列表
7-
EXCLUDE_DIRS = ['.git', '.idea', 'soft', 'binary', 'plugins', 'pyTools', 'drop_code', 'jstest', 'local', 'logs',
7+
EXCLUDE_DIRS = ['.git', '.idea', 'soft', 'plugins/pvideo', 'plugins/req-proxy', 'pyTools', 'drop_code', 'jstest',
8+
'local', 'logs',
89
'对话1.txt',
910
'vod_cache', 'data/mv']
1011

1112
# 要排除的文件列表
12-
EXCLUDE_FILES = ['config/env.json', '.env', 'plugin.js', 'spider/js/UC分享.js', 'spider/js/百忙无果[官].js',
13+
EXCLUDE_FILES = ['config/env.json', '.env', '.claude', 'plugin.js', 'spider/js/UC分享.js', 'spider/js/百忙无果[官].js',
1314
'json/UC分享.json',
1415
'jx/奇奇.js', 'jx/芒果关姐.js', 'data/settings/link_data.json', 'index.json', 'custom.json']
1516

spider/js/多多[盘].js

Lines changed: 129 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ var rule = {
5151
'YOUSEE1': 'UC1',
5252
'YOUSEE11': 'UC2',
5353
},
54+
//线路排序
55+
line_order: ['百度', '优汐', '夸克'],
5456
play_parse: true,
5557
search_match: true,
5658
searchable: 1,
5759
filterable: 1,
60+
timeout: 30000,
5861
quickSearch: 0,
5962
class_name: '电影&剧集&动漫&综艺&记录',
6063
class_url: '1&2&4&3&5&20',
@@ -67,7 +70,6 @@ var rule = {
6770

6871
推荐: async function () {
6972
let {input, pdfa, pdfh, pd} = this;
70-
console.log(`✅input的结果:', ${input}`);
7173
let html = await request(input);
7274
let d = [];
7375
let data = pdfa(html, '.module-items .module-item');
@@ -100,81 +102,136 @@ var rule = {
100102
return setResult(d);
101103
},
102104
二级: async function (ids) {
103-
let {input, pdfa, pdfh, pd} = this;
104-
let html = await request(input);
105-
let data = pdfa(html, '.module-row-title');
105+
try {
106+
console.log("开始加载二级内容...");
107+
let loadStartTime = Date.now();
108+
109+
let {input, pdfa, pdfh, pd} = this;
110+
let html = await request(input);
111+
let data = pdfa(html, '.module-row-title');
112+
113+
let vod = {
114+
vod_name: pdfh(html, '.video-info&&h1&&Text') || '',
115+
type_name: pdfh(html, '.tag-link&&Text') || '',
116+
vod_pic: pd(html, '.lazyload&&data-original||data-src||src') || '',
117+
vod_content: pdfh(html, '.sqjj_a--span&&Text') || '',
118+
vod_remarks: pdfh(html, '.video-info-items:eq(3)&&Text') || '',
119+
vod_year: pdfh(html, '.tag-link:eq(2)&&Text') || '',
120+
vod_area: pdfh(html, '.tag-link:eq(3)&&Text') || '',
121+
vod_actor: pdfh(html, '.video-info-actor:eq(1)&&Text') || '',
122+
vod_director: pdfh(html, '.video-info-actor:eq(0)&&Text') || ''
123+
};
106124

107-
let vod = {
108-
vod_name: pdfh(html, '.video-info&&h1&&Text') || '',
109-
type_name: pdfh(html, '.tag-link&&Text') || '',
110-
vod_pic: pd(html, '.lazyload&&data-original||data-src||src') || '',
111-
vod_content: pdfh(html, '.sqjj_a--span&&Text') || '',
112-
vod_remarks: pdfh(html, '.video-info-items:eq(3)&&Text') || '',
113-
vod_year: pdfh(html, '.tag-link:eq(2)&&Text') || '',
114-
vod_area: pdfh(html, '.tag-link:eq(3)&&Text') || '',
115-
vod_actor: pdfh(html, '.video-info-actor:eq(1)&&Text') || '',
116-
vod_director: pdfh(html, '.video-info-actor:eq(0)&&Text') || ''
117-
};
125+
let playform = [];
126+
let playurls = [];
127+
let playPans = [];
118128

119-
let playform = []
120-
let playurls = []
121-
let playPans = [];
122-
for (let item of data) {
123-
let link = pd(item, 'p&&Text').trim();
124-
if (/pan.quark.cn/.test(link)) {
125-
playPans.push(link);
126-
let shareData = Quark.getShareData(link);
127-
if (shareData) {
128-
let videos = await Quark.getFilesByShareUrl(shareData);
129-
if (videos.length > 0) {
130-
playform.push('Quark-' + shareData.shareId);
131-
playurls.push(videos.map((v) => {
132-
let list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
133-
return v.file_name + '$' + list.join('*');
134-
}).join('#'))
135-
} else {
136-
playform.push('Quark-' + shareData.shareId);
137-
playurls.push("资源已经失效,请访问其他资源")
129+
// 按网盘类型计数
130+
let panCounters = {
131+
'夸克': 1,
132+
'优汐': 1,
133+
'百度': 1
134+
};
135+
136+
// 收集所有线路信息
137+
let allLines = [];
138+
139+
for (let item of data) {
140+
let link = pd(item, 'p&&Text').trim();
141+
if (/pan.quark.cn/.test(link)) {
142+
playPans.push(link);
143+
let shareData = await Quark.getShareData(link);
144+
if (shareData) {
145+
let videos = await Quark.getFilesByShareUrl(shareData);
146+
if (videos.length > 0) {
147+
let lineName = '夸克#' + panCounters.夸克;
148+
let playUrl = videos.map((v) => {
149+
let list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
150+
return v.file_name + '$' + list.join('*');
151+
}).join('#');
152+
allLines.push({name: lineName, url: playUrl, type: '夸克'});
153+
panCounters.夸克++;
154+
} else {
155+
let lineName = '夸克#' + panCounters.夸克;
156+
allLines.push({name: lineName, url: "资源已经失效,请访问其他资源", type: '夸克'});
157+
panCounters.夸克++;
158+
}
138159
}
139-
}
140-
} else if (/drive.uc.cn/.test(link)) {
141-
playPans.push(link);
142-
let shareData = UC.getShareData(link);
143-
if (shareData) {
144-
let videos = await UC.getFilesByShareUrl(shareData);
145-
if (videos.length > 0) {
146-
playform.push('UC-' + shareData.shareId);
147-
playurls.push(videos.map((v) => {
148-
let list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
149-
return v.file_name + '$' + list.join('*');
150-
}).join('#'))
151-
} else {
152-
playform.push('UC-' + shareData.shareId);
153-
playurls.push("资源已经失效,请访问其他资源")
160+
} else if (/drive.uc.cn/i.test(link)) {
161+
playPans.push(link);
162+
let shareData = await UC.getShareData(link);
163+
if (shareData) {
164+
let videos = await UC.getFilesByShareUrl(shareData);
165+
if (videos.length > 0) {
166+
let lineName = '优汐#' + panCounters.优汐;
167+
let playUrl = videos.map((v) => {
168+
let list = [shareData.shareId, v.stoken, v.fid, v.share_fid_token, v.subtitle ? v.subtitle.fid : '', v.subtitle ? v.subtitle.share_fid_token : ''];
169+
return v.file_name + '$' + list.join('*');
170+
}).join('#');
171+
allLines.push({name: lineName, url: playUrl, type: '优汐'});
172+
panCounters.优汐++;
173+
} else {
174+
let lineName = '优汐#' + panCounters.优汐;
175+
allLines.push({name: lineName, url: "资源已经失效,请访问其他资源", type: '优汐'});
176+
panCounters.优汐++;
177+
}
154178
}
155-
}
156-
} else if (/baidu/i.test(link)) {
157-
playPans.push(link);
158-
let shareData = await Baidu.getShareData(link);
159-
if (shareData) {
160-
let files = await Baidu.getFilesByShareUrl(shareData);
161-
if (files.videos && files.videos.length > 0) {
162-
playform.push(`baidu-${shareData.shareId}`);
163-
playurls.push(files.videos.map(v =>
164-
`${v.file_name}$${[shareData.shareId, v.fid, v.file_name].join('*')}`
165-
).join('#'));
166-
} else {
167-
playform.push(`baidu-${shareData.shareId}`);
168-
playurls.push("资源已经失效,请访问其他资源");
179+
} else if (/baidu/i.test(link)) {
180+
playPans.push(link);
181+
let shareData = await Baidu.getShareData(link);
182+
if (shareData) {
183+
let files = await Baidu.getFilesByShareUrl(shareData);
184+
if (files.videos && files.videos.length > 0) {
185+
let lineName = `百度#${panCounters.百度}`;
186+
let playUrl = files.videos.map(v =>
187+
`${v.file_name}$${[shareData.shareId, v.fid, v.file_name].join('*')}`
188+
).join('#');
189+
allLines.push({name: lineName, url: playUrl, type: '百度'});
190+
panCounters.百度++;
191+
} else {
192+
let lineName = `百度#${panCounters.百度}`;
193+
allLines.push({name: lineName, url: "资源已经失效,请访问其他资源", type: '百度'});
194+
panCounters.百度++;
195+
}
169196
}
170197
}
171-
172198
}
199+
200+
// 按照line_order排序
201+
allLines.sort((a, b) => {
202+
let aIndex = rule.line_order.indexOf(a.type);
203+
let bIndex = rule.line_order.indexOf(b.type);
204+
if (aIndex === -1) aIndex = Infinity;
205+
if (bIndex === -1) bIndex = Infinity;
206+
return aIndex - bIndex;
207+
});
208+
209+
// 提取排序后的结果
210+
playform = allLines.map(line => line.name);
211+
playurls = allLines.map(line => line.url);
212+
213+
vod.vod_play_from = playform.join("$$$");
214+
vod.vod_play_url = playurls.join("$$$");
215+
vod.vod_play_pan = playPans.join("$$$");
216+
217+
let loadEndTime = Date.now();
218+
let loadTime = (loadEndTime - loadStartTime) / 1000;
219+
console.log(`二级内容加载完成,耗时: ${loadTime.toFixed(2)}秒`);
220+
221+
return vod;
222+
} catch (error) {
223+
console.error(`❌ 二级函数执行出错: ${error.message}`);
224+
return {
225+
vod_name: '加载失败',
226+
type_name: '错误',
227+
vod_pic: '',
228+
vod_content: `加载失败: ${error.message}`,
229+
vod_remarks: '请检查网络或配置',
230+
vod_play_from: '加载错误$$$所有链接无效',
231+
vod_play_url: `错误信息: ${error.message}$$$请重试或检查配置`,
232+
vod_play_pan: ''
233+
};
173234
}
174-
vod.vod_play_from = playform.join("$$$")
175-
vod.vod_play_url = playurls.join("$$$")
176-
vod.vod_play_pan = playPans.join("$$$")
177-
return vod
178235
},
179236

180237
搜索: async function () {
@@ -204,7 +261,7 @@ var rule = {
204261
let urls = [];
205262
let UCDownloadingCache = {};
206263
let UCTranscodingCache = {};
207-
if (flag.startsWith('Quark-')) {
264+
if (flag.startsWith('夸克')) {
208265
console.log("夸克网盘解析开始")
209266
let down = await Quark.getDownload(ids[0], ids[1], ids[2], ids[3], true);
210267
let headers = {
@@ -229,15 +286,15 @@ var rule = {
229286
url: urls,
230287
header: headers
231288
}
232-
} else if (flag.startsWith('UC-')) {
233-
console.log("UC网盘解析开始");
289+
} else if (flag.startsWith('优汐')) {
290+
console.log("优汐网盘解析开始");
234291
if (!UCDownloadingCache[ids[1]]) {
235292
let down = await UC.getDownload(ids[0], ids[1], ids[2], ids[3], true);
236293
if (down) UCDownloadingCache[ids[1]] = down;
237294
}
238295
let downCache = UCDownloadingCache[ids[1]];
239296
return await UC.getLazyResult(downCache, mediaProxyUrl)
240-
} else if (flag.startsWith('baidu-')) {
297+
} else if (flag.startsWith('百度')) {
241298
console.log("百度网盘解析开始");
242299
let down = await Baidu.getDownload(ids[0], ids[1], ids[2]);
243300
let headers = {

0 commit comments

Comments
 (0)