Skip to content

Commit 947acf6

Browse files
committed
update:解除drpyS源不能任意修改rule.xxx对象的限制
1 parent 818ea9b commit 947acf6

File tree

4 files changed

+43
-11
lines changed

4 files changed

+43
-11
lines changed

Diff for: custom.json

+24
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,37 @@
2424
"searchable": 1,
2525
"ext": ""
2626
},
27+
{
28+
"key": "drpyS_色花堂[密+]",
29+
"name": "色花堂[密+](drpyS)",
30+
"type": 4,
31+
"api": "http://localhost:5757/api/色花堂[密+]",
32+
"searchable": 1,
33+
"ext": ""
34+
},
35+
{
36+
"key": "drpyS_草榴社区[密]",
37+
"name": "草榴社区[密](drpyS)",
38+
"type": 4,
39+
"api": "http://localhost:5757/api/草榴社区[密]",
40+
"searchable": 1,
41+
"ext": ""
42+
},
2743
{
2844
"key": "drpyS_金牌影院",
2945
"name": "金牌影院(drpyS)",
3046
"type": 4,
3147
"api": "http://localhost:5757/api/金牌影院",
3248
"searchable": 1,
3349
"ext": ""
50+
},
51+
{
52+
"key": "drpyS_黑料不打烊[密]",
53+
"name": "黑料不打烊[密](drpyS)",
54+
"type": 4,
55+
"api": "http://localhost:5757/api/黑料不打烊[密]",
56+
"searchable": 1,
57+
"ext": ""
3458
}
3559
]
3660
}

Diff for: index.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,55 @@
44
"key": "drpyS_人人视频",
55
"name": "人人视频(drpyS)",
66
"type": 4,
7-
"api": "http://127.0.0.1:5757/api/人人视频",
7+
"api": "http://localhost:5757/api/人人视频",
88
"searchable": 1,
99
"ext": ""
1010
},
1111
{
1212
"key": "drpyS_星芽短剧",
1313
"name": "星芽短剧(drpyS)",
1414
"type": 4,
15-
"api": "http://127.0.0.1:5757/api/星芽短剧",
15+
"api": "http://localhost:5757/api/星芽短剧",
1616
"searchable": 1,
1717
"ext": ""
1818
},
1919
{
2020
"key": "drpyS_番茄小说[书]",
2121
"name": "番茄小说[书](drpyS)",
2222
"type": 4,
23-
"api": "http://127.0.0.1:5757/api/番茄小说[书]",
23+
"api": "http://localhost:5757/api/番茄小说[书]",
2424
"searchable": 1,
2525
"ext": ""
2626
},
2727
{
2828
"key": "drpyS_色花堂[密+]",
2929
"name": "色花堂[密+](drpyS)",
3030
"type": 4,
31-
"api": "http://127.0.0.1:5757/api/色花堂[密+]",
31+
"api": "http://localhost:5757/api/色花堂[密+]",
3232
"searchable": 1,
3333
"ext": ""
3434
},
3535
{
3636
"key": "drpyS_草榴社区[密]",
3737
"name": "草榴社区[密](drpyS)",
3838
"type": 4,
39-
"api": "http://127.0.0.1:5757/api/草榴社区[密]",
39+
"api": "http://localhost:5757/api/草榴社区[密]",
4040
"searchable": 1,
4141
"ext": ""
4242
},
4343
{
4444
"key": "drpyS_金牌影院",
4545
"name": "金牌影院(drpyS)",
4646
"type": 4,
47-
"api": "http://127.0.0.1:5757/api/金牌影院",
47+
"api": "http://localhost:5757/api/金牌影院",
4848
"searchable": 1,
4949
"ext": ""
5050
},
5151
{
5252
"key": "drpyS_黑料不打烊[密]",
5353
"name": "黑料不打烊[密](drpyS)",
5454
"type": 4,
55-
"api": "http://127.0.0.1:5757/api/黑料不打烊[密]",
55+
"api": "http://localhost:5757/api/黑料不打烊[密]",
5656
"searchable": 1,
5757
"ext": ""
5858
}

Diff for: js/金牌影院.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ var rule = {
1414
quickSearch: 0,
1515
timeout: 5000,
1616
play_parse: true,
17+
headers: {
18+
'User-Agent': 'MOBILE_UA',
19+
},
1720
class_parse: async () => {
1821
let classes = [{
1922
type_id: '1',
@@ -140,12 +143,14 @@ var rule = {
140143
'authorization': '',
141144
}
142145
})).content)
143-
return {parse: 0, url: getProxyUrl()+'&url='+html.data.playUrl, js: ''}
146+
return {parse: 0, url: getProxyUrl()+'&url='+encodeURIComponent(html.data.playUrl), js: ''}
144147
},
145148
proxy_rule: async function() {
146149
let {input} = this
147150
if (input) {
148-
let m3u8 = (await req(input)).content;
151+
input = decodeURIComponent(input);
152+
log(`${rule.title}代理播放:${input}`);
153+
let m3u8 = (await req(input,{headers:rule.headers})).content;
149154
const lines = m3u8.split('\n');
150155
const tsUrls = [];
151156
let link_start = ''

Diff for: libs/drpyS.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ export async function init(filePath, env, refresh) {
183183
const script = new vm.Script(js_code);
184184
script.runInContext(context);
185185

186-
// 访问沙箱中的 rule 对象
187-
const moduleObject = utils.deepCopy(sandbox.rule);
186+
// 访问沙箱中的 rule 对象。不进行deepCopy了,避免初始化或者预处理对rule.xxx进行修改后,在其他函数里使用却没生效问题
187+
// const moduleObject = utils.deepCopy(sandbox.rule);
188+
const moduleObject = sandbox.rule;
188189
await initParse(moduleObject);
189190

190191
// 检查并执行 `预处理` 方法
@@ -195,6 +196,7 @@ export async function init(filePath, env, refresh) {
195196

196197
let t2 = utils.getNowTime();
197198
moduleObject.cost = t2 - t1;
199+
// console.log(`${filePath} headers:`, moduleObject.headers);
198200

199201
// 缓存模块和文件的 hash 值
200202
moduleCache.set(filePath, {moduleObject, hash: fileHash});
@@ -361,6 +363,7 @@ async function initParse(rule) {
361363
console.log(v);
362364
if (['MOBILE_UA', 'PC_UA', 'UC_UA', 'IOS_UA', 'UA'].includes(v)) {
363365
rule.headers[k] = eval(v);
366+
log(rule.headers[k])
364367
}
365368
} else if (k.toLowerCase() === 'cookie') {
366369
let v = rule.headers[k];

0 commit comments

Comments
 (0)