Skip to content

Commit 2acb8df

Browse files
author
Taois
committed
feat: 修复bug,升级drplayer
1 parent 6560b94 commit 2acb8df

File tree

7 files changed

+659
-469
lines changed

7 files changed

+659
-469
lines changed

apps/drplayer/assets/index-CB6R_dhB.js

Lines changed: 456 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-D-n9yQOT.css

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

apps/drplayer/assets/index-DF9VKEF_.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-Dy8TQUYS.js

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

apps/drplayer/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/apps/drplayer/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="referrer" content="no-referrer" />
78
<title>DrPlayer</title>
8-
<script type="module" crossorigin src="/apps/drplayer/assets/index-Dy8TQUYS.js"></script>
9-
<link rel="stylesheet" crossorigin href="/apps/drplayer/assets/index-D-n9yQOT.css">
9+
<script type="module" crossorigin src="/apps/drplayer/assets/index-CB6R_dhB.js"></script>
10+
<link rel="stylesheet" crossorigin href="/apps/drplayer/assets/index-DF9VKEF_.css">
1011
</head>
1112
<body>
1213
<div id="app"></div>

libs_drpy/drpyInject.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,33 @@ async function request(url, opt = {}) {
159159
}
160160

161161
// 根据 postType 处理数据
162-
if (postType === 'form' && data != null) {
162+
// 如果没有明确指定 postType,尝试从 Content-Type 推断
163+
let effectivePostType = postType;
164+
if (!effectivePostType) {
165+
// 查找不区分大小写的 Content-Type 头
166+
const contentTypeKey = Object.keys(headers).find(key =>
167+
key.toLowerCase() === 'content-type'
168+
);
169+
170+
if (contentTypeKey && headers[contentTypeKey]) {
171+
const contentType = headers[contentTypeKey].toLowerCase();
172+
if (contentType.includes('application/x-www-form-urlencoded')) {
173+
effectivePostType = 'form';
174+
} else if (contentType.includes('multipart/form-data')) {
175+
effectivePostType = 'form-data';
176+
}
177+
}
178+
}
179+
180+
// 根据有效的 postType 处理数据
181+
if (effectivePostType === 'form' && data != null) {
163182
data = qs.stringify(data, {encode: false});
164-
} else if (postType === 'form-data') {
183+
} else if (effectivePostType === 'form-data' && data != null) {
165184
data = toFormData(data);
166185
}
186+
if (data) {
187+
console.log(`[req] postType:${effectivePostType},data:`, data);
188+
}
167189

168190
// 配置代理或 HTTPS Agent
169191
// httpsAgent = new https.Agent({rejectUnauthorized: false});
@@ -173,7 +195,7 @@ async function request(url, opt = {}) {
173195
const respType = returnBuffer ? 'arraybuffer' : 'arraybuffer';
174196

175197
if (ENV.get('show_req', '0') === '1') {
176-
console.log(`req: ${url} headers: ${JSON.stringify(headers)} data: ${JSON.stringify(data)}`);
198+
console.log(`req[${method}]: ${url} headers: ${JSON.stringify(headers)} data: ${JSON.stringify(data)}`);
177199
}
178200
try {
179201
// 发送请求
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
/* 青木倪壁纸
2+
@header({
3+
searchable: 1,
4+
filterable: 1,
5+
quickSearch: 1,
6+
title: '青木倪壁纸',
7+
lang: 'cat'
8+
})
9+
*/
10+
11+
let siteKey = "", siteType = "", sourceKey = "", ext = "";
12+
const limit = 50;
13+
14+
async function request(data) {
15+
const resp = await req('https://www.6qmn.com/index.php/joe/api', {
16+
method: 'POST',
17+
body: data,
18+
headers: {
19+
'Referer': 'https://www.6qmn.com/',
20+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
21+
'content-type': 'application/x-www-form-urlencoded'
22+
}
23+
});
24+
return resp.content;
25+
}
26+
27+
function init(cfg) {
28+
siteKey = cfg.skey;
29+
siteType = cfg.stype;
30+
sourceKey = cfg.sourceKey;
31+
ext = cfg.ext;
32+
}
33+
34+
async function home(filter) {
35+
const res = await request({
36+
routeType: 'wallpaper_type'
37+
});
38+
39+
const data = JSON.parse(res).data;
40+
let classes = [];
41+
for (const item of data) {
42+
classes.push({
43+
'type_id': item.name + '$' + item.id,
44+
'type_name': item.name,
45+
'type_flag': '0-0-16T9'
46+
});
47+
}
48+
return JSON.stringify({
49+
'class': classes,
50+
'type_flag': '0-0-16T9'
51+
});
52+
}
53+
54+
function homeVod(params) {
55+
return category('4K专区$36', 1);
56+
}
57+
58+
async function category(tid, pg, filter, extend) {
59+
const page = pg || 1;
60+
console.log('tid:' + tid + ', pg:' + pg + ', filter:' + filter + ', extend:' + JSON.stringify(extend));
61+
62+
const videos = [];
63+
64+
const ajax_data = {
65+
routeType: 'wallpaper_list',
66+
cid: tid.split('$')[1],
67+
start: (page - 1) * limit,
68+
count: limit
69+
};
70+
const res = await request(ajax_data);
71+
72+
const json = JSON.parse(res);
73+
const total = parseInt(json.total);
74+
const pagecount = Math.ceil(total / limit);
75+
let index = (page - 1) * limit;
76+
for (const v of json.data) {
77+
const video = {
78+
'vod_id': tid + '|' + total + '$' + pagecount + '$' + page + '|' + v.utag + '|' + v.url,
79+
'vod_name': v.utag,
80+
'vod_pic': v.url,
81+
'vod_remarks': '' + page
82+
};
83+
videos.push(video);
84+
index++;
85+
}
86+
87+
return JSON.stringify({
88+
'page': pg,
89+
'pagecount': pagecount,
90+
'limit': limit,
91+
'total': total,
92+
'list': videos,
93+
'type_des': ''
94+
});
95+
}
96+
97+
function detail(id) {
98+
const info = id.split('|');
99+
const total = parseInt(info[1].split('$')[0]);
100+
const pagecount = parseInt(info[1].split('$')[1]);
101+
const page = parseInt(info[1].split('$')[2]);
102+
const cid = info[0].split('$')[1];
103+
let vod = {
104+
'vod_id': id,
105+
'vod_name': info[0].split('$')[0],
106+
'vod_pic': info[3],
107+
'type_name': '壁纸',
108+
'vod_content': info[0].split('$')[0] + ',共 ' + total + ' 张壁纸,每页 ' + limit + ' 张,共 ' + pagecount + ' 页',
109+
'vod_play_from': '青木倪',
110+
'vod_play_url': ''
111+
};
112+
const urls = ['0$' + info[2] + '@' + info[3]];
113+
for (let i = 1; i <= pagecount; i++) {
114+
urls.push(i + '$' + cid + '-' + i);
115+
}
116+
vod['vod_play_url'] = urls.join("#");
117+
// console.log(JSON.stringify({'list':[vod]}));
118+
return JSON.stringify({
119+
'list': [vod]
120+
});
121+
}
122+
123+
async function play(flag, id, flags) {
124+
let info = id.split('-');
125+
if (info.length == 1) {
126+
return {
127+
parse: 0,
128+
url: 'pics://' + id.replace('@', '$').split('$').slice(-1)[0],
129+
}
130+
}
131+
132+
const page = parseInt(info[1]);
133+
const ajax_data = {
134+
routeType: 'wallpaper_list',
135+
cid: info[0],
136+
start: (page - 1) * limit,
137+
count: limit
138+
};
139+
const res = await request(ajax_data);
140+
// console.log(res);
141+
142+
const json = JSON.parse(res);
143+
let content = [];
144+
for (const v of json.data) {
145+
// content.push(v.utag + '$' + v.url);
146+
content.push(v.url);
147+
}
148+
return {
149+
parse: 0,
150+
url: 'pics://' + content.join('&&'),
151+
}
152+
}
153+
154+
export function __jsEvalReturn() {
155+
return {
156+
init: init,
157+
home: home,
158+
homeVod: homeVod,
159+
category: category,
160+
detail: detail,
161+
play: play,
162+
proxy: null,
163+
search: null,
164+
extResult: null,
165+
};
166+
}

0 commit comments

Comments
 (0)