Skip to content

Commit 6ffa98c

Browse files
committed
update:更新一些细节
1 parent e2ff422 commit 6ffa98c

19 files changed

+603
-189
lines changed

Diff for: controllers/api.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default (fastify, options, done) => {
8686
// console.error('Error processing request:', error);
8787
// reply.status(500).send({error: `Failed to process request for module ${moduleName}: ${error.message}`});
8888

89-
fastify.log.error(`Error proxy module ${moduleName}:${error.message}`);
89+
fastify.log.error(`Error api module ${moduleName}:${error.message}`);
9090
reply.status(500).send({error: `Failed to process module ${moduleName}: ${error.message}`});
9191
}
9292
});

Diff for: custom.json

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@
4040
"quickSearch": 0,
4141
"ext": ""
4242
},
43+
{
44+
"key": "drpyS_央视大全[官]",
45+
"name": "央视大全[官](DS)",
46+
"type": 4,
47+
"api": "http://192.168.31.49:5757/api/央视大全[官]",
48+
"searchable": 1,
49+
"filterable": 1,
50+
"quickSearch": 0,
51+
"ext": ""
52+
},
4353
{
4454
"key": "drpyS_星芽短剧",
4555
"name": "星芽短剧(DS)",

Diff for: docs/updateRecord.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# drpyS更新记录
22

3+
### 20241210
4+
5+
更新至V1.0.7
6+
7+
1. 新增drpyBatchFetch.js、用3种不同方式实现drpy的batchFetch批量请求函数
8+
2. 引入hls-parser库用于解析处理m3u8等流媒体文件,在drpyS中提供全局对象hlsParser
9+
3. 新增央视
10+
4. 修复人人
11+
5. 完善batchFetch的4种实现方案
12+
313
### 20241209
414

515
更新至V1.0.6
@@ -9,9 +19,11 @@
919
3. 新增batchFetch批量请求,给drpyS源提速!!!腾云驾雾源的二级请求已提速,几百个播放链接的动漫二级秒加载
1020
4. 增加ptt[],同样支持二级batchFetch
1121
5. 海阔暂不支持源里执行eval,腾云驾雾二级访问不了,现在临时修改为
22+
1223
```javascript
1324
QZOutputJson = JSON5.parse(ht.split('QZOutputJson=')[1].slice(0, -1));
1425
```
26+
1527
6. 手写队列,兼容海阔nodejs单任务版不支持queque等三方模块的问题
1628
7. 修复pdfh不含属性解析的情况下返回结果不是字符串问题与之影响的黑料源
1729

Diff for: drop_code/batchFetch.js

-33
This file was deleted.

Diff for: index.json

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@
4040
"quickSearch": 0,
4141
"ext": ""
4242
},
43+
{
44+
"key": "drpyS_央视大全[官]",
45+
"name": "央视大全[官](DS)",
46+
"type": 4,
47+
"api": "http://127.0.0.1:5757/api/央视大全[官]",
48+
"searchable": 1,
49+
"filterable": 1,
50+
"quickSearch": 0,
51+
"ext": ""
52+
},
4353
{
4454
"key": "drpyS_星芽短剧",
4555
"name": "星芽短剧(DS)",

Diff for: js/PTT[优].js

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ var rule = {
112112
}
113113
});
114114
let htmls = await batchFetch(reqUrls);
115+
let t2 = (new Date()).getTime();
116+
log(`批量请求二级 ${input} 耗时${t2 - t1}毫秒:`);
115117
htmls.forEach((ht) => {
116118
if (ht) {
117119
let list0 = pdfa(ht, '.mb-2.fullwidth&&a').map(it => pdfh(it, 'a&&Text') + '$' + pd(it, 'a&&href', input));
@@ -120,8 +122,7 @@ var rule = {
120122
lists.push([]);
121123
}
122124
});
123-
let t2 = (new Date()).getTime();
124-
log(`批量请求二级 ${input} 耗时${t2 - t1}毫秒:`);
125+
125126
}
126127
let playUrls = lists.map(it => it.join('#'));
127128
VOD.vod_play_url = playUrls.join('$$$');

Diff for: js/_fq2.js

+48-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
// http://localhost:5757/api/番茄小说[书]?ac=list&t=主分类&pg=1
2+
23
const {getRandomFromList} = $.require('./_lib.random.js');
4+
5+
function testHls() {
6+
log(typeof hlsParser)
7+
8+
// 假设m3u8Content是你的M3U8文件内容
9+
const m3u8Content = `#EXTM3U
10+
#EXT-X-VERSION:3
11+
#EXT-X-TARGETDURATION:10
12+
#EXTINF:10,
13+
http://example.com/first.ts
14+
#EXTINF:10,
15+
http://example.com/second.ts
16+
#EXTINF:10,
17+
http://example.com/third.ts`;
18+
19+
// 解析M3U8文件内容
20+
const playlist = hlsParser.parse(m3u8Content);
21+
22+
// 检查是否存在segments并且长度大于0
23+
if (playlist.segments && playlist.segments.length > 0) {
24+
// 删除第一个播放地址
25+
playlist.segments.shift();
26+
}
27+
28+
// 将修改后的播放列表对象转换回M3U8文件内容
29+
const newM3u8Content = hlsParser.stringify(playlist);
30+
31+
console.log(newM3u8Content);
32+
}
33+
334
var rule = {
435
类型: '小说',
536
title: '番茄小说[书]',
@@ -10,28 +41,30 @@ var rule = {
1041
class_parse: async () => {
1142
log(btoa('123456'));
1243
log(misc.randMAC());
13-
log(getRandomFromList(['drpy','drpyS','hipy']));
14-
log('oheaders:',oheaders)
15-
log('rule_fetch_params:',rule_fetch_params)
16-
log('type of batchFetch:',batchFetch)
44+
log(getRandomFromList(['drpy', 'drpyS', 'hipy']));
45+
log('oheaders:', oheaders)
46+
log('rule_fetch_params:', rule_fetch_params)
47+
log('type of batchFetch:', batchFetch)
48+
49+
testHls()
1750
// return {}
1851
},
19-
headers:{
20-
'User-Agent':'PC_UA',
52+
headers: {
53+
'User-Agent': 'PC_UA',
2154
},
2255
预处理: async () => {
2356
},
24-
推荐: async () => {
57+
推荐1: async () => {
2558
// globalThis.fetch_params = {'ua':'xxxx'} // 移除fetch_params,因为不能局部变量,全局变量会导致串数据
2659
// let html = await request('https://www.baidu.com/')
2760
// log(html)
28-
log(typeof RULE_CK,RULE_CK);
29-
log(typeof RKEY,RKEY);
30-
log('getItem:',typeof getItem);
31-
log('setItem:',typeof setItem);
32-
log('fetch:',typeof fetch);
33-
log('jsp:',typeof jsp);
34-
log('pdfh:',typeof pdfh);
61+
log(typeof RULE_CK, RULE_CK);
62+
log(typeof RKEY, RKEY);
63+
log('getItem:', typeof getItem);
64+
log('setItem:', typeof setItem);
65+
log('fetch:', typeof fetch);
66+
log('jsp:', typeof jsp);
67+
log('pdfh:', typeof pdfh);
3568
// setItem(RULE_CK, 'dd僵尸大时代');
3669
log(getItem(RULE_CK));
3770
log(jsp.MY_URL);
@@ -40,7 +73,7 @@ var rule = {
4073
},
4174
一级: async (tid, pg, filter, extend) => {
4275
console.log(input);
43-
console.log({tid,pg,filter,extend});
76+
console.log({tid, pg, filter, extend});
4477
console.log(rule.host);
4578
console.log(rule.host.rstrip('/'));
4679
},

Diff for: js/人人视频.js

+47-29
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// http://localhost:5757/api/人人视频?ac=detail&ids=447
33
// http://localhost:5757/api/人人视频?wd=&pg=1
44
// http://localhost:5757/api/人人视频?play=&flag=人人视频
5-
const {getPublicIp} = $.require('./_lib.request.js');
6-
5+
const {getPublicIp} = $.require('_lib.request.js');
76
var rule = {
87
类型: '影视',
98
title: '人人视频',
@@ -100,12 +99,13 @@ var rule = {
10099
let playmap = {};
101100
for (const i in playlist) {
102101
let form = playlist[i].player_info.show
102+
let user_agent = playlist[i].player_info.user_agent
103103
const list = playlist[i].urls
104104
if (!playmap.hasOwnProperty(form)) {
105105
playmap[form] = [];
106106
}
107107
for (const i in list) {
108-
playmap[form].push(list[i].name.trim() + '$' + encodeURIComponent(list[i].parse_api_url));
108+
playmap[form].push(list[i].name.trim() + '$' + encodeURIComponent(list[i].parse_api_url + '#' + user_agent));
109109

110110
}
111111
}
@@ -141,69 +141,87 @@ var rule = {
141141
lazy: async function (flag, id, flags) {
142142
let {getProxyUrl, input} = this;
143143
if (input.indexOf('m3u8') < 0) {
144-
input = input.replace('$ip',rule.ip);
145-
let html = JSON.parse((await req(input, {
146-
method: 'post',
147-
// headers: {
148-
// 'User-Agent': 'Mozilla/9.0 (Macintosh; Intel Mac OS X 10.8; rv:69.0) Gecko/20100101 Firefox/69.0'
149-
// },
150-
headers: rule.headers,
151-
})).content)
152-
let link = html.url
153-
return {parse: 0, url: link}
154-
// return {parse: 0, url: getProxyUrl() + '&url=' + encodeURIComponent(link), js: ''}
144+
if (input.indexOf('json.php') > 0) {
145+
let html = JSON.parse((await req(input.split('#')[0], {
146+
method: 'post',
147+
headers: {
148+
'User-Agent': input.split('#')[1]
149+
}
150+
})).content)
151+
let link = html.url
152+
return {parse: 0, url: getProxyUrl() + '&url=' + encodeURIComponent(link), js: ''}
153+
} else if (input.indexOf('parse.php') > 0) {
154+
let html = JSON.parse((await req(input.split('#')[0], {
155+
method: 'post',
156+
headers: {
157+
'User-Agent': input.split('#')[1],
158+
'Connection': 'Keep-Alive',
159+
'Accept-Encoding': 'gzip',
160+
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
161+
}
162+
})).content)
163+
let link = html.url
164+
return {parse: 0, url: link, js: ''}
165+
} else {
166+
let html = JSON.parse((await req(input.split('#')[0], {
167+
method: 'post',
168+
headers: {
169+
'User-Agent': input.split('#')[1],
170+
'Connection': 'Keep-Alive',
171+
'Accept-Encoding': 'gzip',
172+
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
173+
}
174+
})).content)
175+
let link = html.url
176+
return {parse: 0, url: link, js: ''}
177+
}
155178
} else {
156-
return {parse: 0, url: getProxyUrl() + '&url=' + input, js: ''}
179+
return {parse: 0, url: getProxyUrl() + '&url=' + encodeURIComponent(input.split('#')[0]), js: ''}
157180
}
158181
},
159-
proxy_rule: async function (params) {
182+
proxy_rule: async function () {
160183
let {input} = this;
161-
input = decodeURIComponent(input);
162-
if (input.includes('.mp4')) {
163-
return [302, getContentType(input), '', {location: input}];
164-
}
165184
if (input.indexOf('m3u8') < 0) {
166-
let m3u8_content = (await req(input)).content
185+
let m3u8_content = (await req(decodeURIComponent(input))).content
167186
let m3u8 = m3u8_content.replace(/#EXTINF:10\.333333,\s*https?:\/\/[^\s]+\n#EXT-X-DISCONTINUITY/, '')
168187
return [200, 'application/vnd.apple.mpegurl', m3u8]
169188
} else {
170-
let m3u8_content = (await req(input)).content
189+
let m3u8_content = (await req(decodeURIComponent(input))).content.replace(/#EXTINF:10\.333333,\s*https?:\/\/[^\s]+\n#EXT-X-DISCONTINUITY/, '')
171190
//https?:\/\/[^\s]+piantou\.(txt|zip)|piantou.txt|piantou.zip
172-
if (m3u8_content.indexOf('piantou') > 0) {
191+
if (m3u8_content.match(/https?:\/\/[^\s]+piantou\.(txt|zip|psd)|piantou.txt|piantou.zip|piantou.psd/)) {
173192
const lines = m3u8_content.split('\n');
174193
const tsUrls = [];
175194
let link_start = ''
176195
lines.forEach(line => {
177-
if (line.trim().startsWith('http') && line.trim().indexOf('piantou') < 0 && line.trim().endsWith('.txt') || line.trim().endsWith('.zip')) {
196+
if (line.trim().startsWith('http') && line.trim().indexOf('piantou') < 0 && /txt|zip|psd/.test(line.trim())) {
178197
tsUrls.push(line)
179198
}
180-
if (line.trim().endsWith('.txt') || line.trim().endsWith('.zip') && line.trim().indexOf('piantou') < 0) {
199+
if (/txt|zip|psd/.test(line.trim()) && line.trim().indexOf('piantou') < 0) {
181200
link_start = input.split('?')[0].replace('playlist.m3u8', '')
182201
tsUrls.push(link_start + line.trim())
183202
} else {
184203
tsUrls.push(line)
185204
}
186205
})
187206
let m3u8_text = tsUrls.join('\n')
188-
// log(m3u8_text)
207+
log(m3u8_text)
189208
return [200, 'application/vnd.apple.mpegurl', m3u8_text]
190209
} else {
191210
const lines = m3u8_content.split('\n');
192211
const tsUrls = [];
193212
let link_start = ''
194213
lines.forEach(line => {
195-
if (line.trim().startsWith('http') && line.trim().endsWith('.txt') || line.trim().endsWith('.zip')) {
214+
if (line.trim().startsWith('http') && /txt|zip|psd/.test(line.trim())) {
196215
tsUrls.push(line)
197216
}
198-
if (line.trim().endsWith('.txt') || line.trim().endsWith('.zip')) {
217+
if (/txt|zip|psd/.test(line.trim())) {
199218
link_start = input.split('?')[0].replace('playlist.m3u8', '')
200219
tsUrls.push(link_start + line.trim())
201220
} else {
202221
tsUrls.push(line)
203222
}
204223
})
205224
let m3u8_text = tsUrls.join('\n')
206-
log(m3u8_text)
207225
return [200, 'application/vnd.apple.mpegurl', m3u8_text]
208226
}
209227
}

0 commit comments

Comments
 (0)