Skip to content

Commit 92f5d8f

Browse files
author
Taois
committed
feat: 更新drplayer,完善画质功能,和目录分类模式
1 parent 3604b43 commit 92f5d8f

File tree

6 files changed

+769
-600
lines changed

6 files changed

+769
-600
lines changed

apps/drplayer/assets/index-BFYwyjrV.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

apps/drplayer/assets/index-Bm0e_-wQ.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/drplayer/assets/index-DU9-3QWR.js

Lines changed: 606 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/drplayer/assets/index-wNYbVjOr.js

Lines changed: 0 additions & 589 deletions
This file was deleted.

apps/drplayer/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<meta name="referrer" content="no-referrer" />
88
<title>DrPlayer</title>
9-
<script type="module" crossorigin src="/apps/drplayer/assets/index-wNYbVjOr.js"></script>
10-
<link rel="stylesheet" crossorigin href="/apps/drplayer/assets/index-BFYwyjrV.css">
9+
<script type="module" crossorigin src="/apps/drplayer/assets/index-DU9-3QWR.js"></script>
10+
<link rel="stylesheet" crossorigin href="/apps/drplayer/assets/index-Bm0e_-wQ.css">
1111
</head>
1212
<body>
1313
<div id="app"></div>

spider/js_dr2/03影院[优].js

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/*
2+
@header({
3+
searchable: 1,
4+
filterable: 1,
5+
quickSearch: 1,
6+
title: '03影视',
7+
author: '小可乐/250915/第一版',
8+
'类型': '影视',
9+
lang: 'dr2'
10+
})
11+
*/
12+
13+
var rule = {
14+
author: '小可乐/250915/第一版',
15+
title: '03影视',
16+
类型: '影视',
17+
host: 'https://www.03yy.live',
18+
headers: {
19+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/128.0.0.0 Safari/537.36',
20+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
21+
'Accept-Language': 'zh-CN,zh;q=0.9'
22+
},
23+
编码: 'utf-8',
24+
timeout: 5000,
25+
url: '/type/indexfyclass-fypage.html',
26+
filter_url: '',
27+
searchUrl: '/search.php?searchword=**',
28+
searchable: 1,
29+
quickSearch: 1,
30+
filterable: 1,
31+
32+
class_name: '电影&电视剧&综艺&动漫',
33+
class_url: '1&2&3&4',
34+
filter_def: {},
35+
预处理: $js.toString(() => {
36+
// 使用withHeaders: true来获取响应头
37+
const res = request(HOST, {
38+
headers: rule.headers,
39+
withHeaders: true,
40+
redirect: false,
41+
method: 'GET'
42+
});
43+
const resJson = typeof res === 'string' ? JSON.parse(res) : res;
44+
45+
// 提取set-cookie头
46+
const setCookie = resJson['set-cookie'] || '';
47+
48+
// 处理cookie格式
49+
let cookies = '';
50+
if (Array.isArray(setCookie)) {
51+
cookies = setCookie.map(c => c.split(';')[0].trim()).join('; ');
52+
} else if (setCookie) {
53+
cookies = setCookie.split(';')[0].trim();
54+
}
55+
56+
// 更新rule.headers中的cookie
57+
if (cookies) {
58+
rule.headers["cookie"] = rule.headers["cookie"] ?
59+
rule.headers["cookie"] + '; ' + cookies : cookies;
60+
rule_fetch_params.headers = Object.assign({}, rule.headers);
61+
}
62+
63+
console.log(`提取的Cookie: ${cookies || '无'}`);
64+
console.log(`最终Cookie: ${rule.headers["cookie"] || '无'}`);
65+
}),
66+
play_parse: true,
67+
lazy: $js.toString(() => {
68+
let html = request(input, {
69+
headers: rule.headers,
70+
withHeaders: true,
71+
redirect: false,
72+
method: 'GET'
73+
});
74+
75+
// 处理转义引号:将 \" 替换为 "
76+
html = html.replace(/\\"/g, '"');
77+
78+
// 匹配参数
79+
const nowMatch = html.match(/var\s+now\s*=\s*base64decode\s*\(\s*["']([^"']+)["']\s*\)/);
80+
const prePageMatch = html.match(/var\s+prePage\s*=\s*["']([^"']+)["']/);
81+
const nextPageMatch = html.match(/var\s+nextPage\s*=\s*["']([^"']+)["']/);
82+
var now = nowMatch[1];
83+
now = base64Decode(now);
84+
console.log("now:" + now);
85+
86+
if (/\.(m3u8|mp4|mkv|jpg)/.test(now)) {
87+
input = {parse: 0, url: now}
88+
} else {
89+
const prePage = prePageMatch[1];
90+
const nextPage = nextPageMatch[1];
91+
console.log("prePage:" + prePage);
92+
console.log("nextPage:" + nextPage);
93+
94+
let jx = `${HOST}/api/dplayer.php?url=${now}&ref=${encodeURIComponent(prePage)}&next=${encodeURIComponent(nextPage)}`;
95+
96+
console.log("请求URL:" + jx);
97+
98+
let videohtml = request(jx, {
99+
headers: rule.headers,
100+
withHeaders: true,
101+
redirect: false,
102+
method: 'GET'
103+
});
104+
console.log("videohtml:" + videohtml);
105+
106+
const mediaInfoRegex = /mediaInfo\s*=\s*(\[.*?\]);/gis;
107+
const mediaInfoMatch = mediaInfoRegex.exec(videohtml);
108+
let videoUrl = "";
109+
110+
if (mediaInfoMatch && mediaInfoMatch[1]) {
111+
const mediaInfoContent = mediaInfoMatch[1];
112+
const qualityLevels = ["1080", "720", "540", "360"];
113+
const urls = [];
114+
for (const quality of qualityLevels) {
115+
const urlRegex = new RegExp(
116+
`definition.*?${quality}.*?url.*?:.*?"(https.*?)"`,
117+
'is'
118+
);
119+
const urlMatch = mediaInfoContent.match(urlRegex);
120+
if (urlMatch && urlMatch[1]) {
121+
videoUrl = urlMatch[1];
122+
videoUrl = videoUrl.replace(/\\\\\//g, '/').replace(/\\+/g, '');
123+
console.log(`找到${quality}清晰度的URL:`, videoUrl);
124+
urls.push(quality, videoUrl);
125+
}
126+
}
127+
input = { parse: 0, url: urls };
128+
if (!videoUrl) {
129+
console.log("未找到任何已知清晰度的URL");
130+
}
131+
} else {
132+
console.error("未匹配到mediaInfo");
133+
}
134+
}
135+
}),
136+
limit: 9,
137+
double: true,
138+
推荐: '.Pic-list&&.pic-content;a&&title;img&&src;span&&Text;a&&href',
139+
一级: '.type-box&&.pic-height-a;a&&title;img&&src;span&&Text;a&&href',
140+
二级: {
141+
title: 'h2&&Text;.m-content&&ul&&li:eq(4)',
142+
img: 'img&&src',
143+
desc: '.color-red&&Text;.m-content&&ul&&span:eq(2)&&Text;.m-content&&ul&&span:eq(0)&&Text;.m-content&&ul&&li:eq(1)&&Text;.m-content&&ul&&li:eq(0)&&Text',
144+
content: '.m-intro&&Text',
145+
tabs: '#playlist&&li',
146+
tab_text: 'body&&Text',
147+
lists: '.play_list:eq(#id)&&li',
148+
list_text: 'body&&Text',
149+
list_url: 'a&&href'
150+
},
151+
搜索: '*',
152+
}

0 commit comments

Comments
 (0)