Skip to content

Commit 6561b0e

Browse files
committed
update:技术性研究
1 parent aba6d83 commit 6561b0e

File tree

8 files changed

+219
-10
lines changed

8 files changed

+219
-10
lines changed

custom.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 73,
2+
"sites_count": 74,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -133,6 +133,16 @@
133133
"quickSearch": 0,
134134
"ext": "H4sIAAAAAAAAA9PT088qzs/TD3V+2tH2ZNdqPRAPAKubOwMVAAAA"
135135
},
136+
{
137+
"key": "drpyS_低端[盘]",
138+
"name": "低端[盘](DS)",
139+
"type": 4,
140+
"api": "http://localhost:5757/api/低端[盘]",
141+
"searchable": 2,
142+
"filterable": 0,
143+
"quickSearch": 0,
144+
"ext": ""
145+
},
136146
{
137147
"key": "drpyS_团长资源[盘]",
138148
"name": "团长资源[盘](DS)",

docs/updateRecord.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# drpyS更新记录
22

3+
### 20250112
4+
5+
今日无更新,但是做了一些相关技术性研究
6+
7+
1. `drpyInject.js` req系列函数支持拦截器打印转换的curl命令
8+
2. 添加 `低端[盘].js` 尝试解决cf导致的获取源码错误问题以失败告终(py的requests也请求不到源码,我也很绝望,还研究了axios升级http2协议也没卵用,不知道是请求头哪儿的差异,dr2的js正常用,想不明白了)
9+
3. 研究 `好乐影视.js` 不正常问题,发现请求到的源码里面都是一些location.href=的链接跳转,浏览器访问网站当然没问题,写成源一脸懵逼,没啥好办法。
10+
311
### 20250111
412

513
更新至V1.1.7

index.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sites_count": 73,
2+
"sites_count": 74,
33
"sites": [
44
{
55
"key": "drpyS_设置中心",
@@ -133,6 +133,16 @@
133133
"quickSearch": 0,
134134
"ext": "H4sIAAAAAAAAA9PT088qzs/TD3V+2tH2ZNdqPRAPAKubOwMVAAAA"
135135
},
136+
{
137+
"key": "drpyS_低端[盘]",
138+
"name": "低端[盘](DS)",
139+
"type": 4,
140+
"api": "http://localhost:5757/api/低端[盘]",
141+
"searchable": 2,
142+
"filterable": 0,
143+
"quickSearch": 0,
144+
"ext": ""
145+
},
136146
{
137147
"key": "drpyS_团长资源[盘]",
138148
"name": "团长资源[盘](DS)",

js/_fq3.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ const rule = {
9191
homeUrl: 'https://fanqienovel.com/api/author/book/category_list/v0/',
9292
url: '/api/author/library/book_list/v0/?page_count=18&page_index=(fypage-1)&gender=-1&category_id=fyclass&creation_status=-1&word_count=-1&sort=0#fyfilter',
9393
class_parse: async function () {
94+
let html = (await req('https://self-signed.badssl.com/')).content;
95+
log(html);
96+
},
97+
class_parse2: async function () {
9498
let {proxyUrl, getRule} = this;
9599
// let ip = await getPublicIp1();
96100
let ip = await getPublicIp2();

js/低端[盘].js

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// 网址发布页 https://ddys.site
2+
// 网址发布页 https://ddys.wiki
3+
// 网址发布页 https://ddys.info/
4+
var rule = {
5+
title: 'ddys',
6+
// host: 'https://ddys.pro',
7+
host: 'https://ddys.mov/',
8+
/*host: 'https://ddys.info',
9+
hostJs: async function () {
10+
let{HOST}=this
11+
let html = await request(HOST,{headers: {'User-Agent': MOBILE_UA}});
12+
HOST = pdfh(html, 'a&&href');
13+
return HOST;
14+
},*/
15+
url: '/fyclass/page/fypage/',
16+
searchUrl: '/?s=**&post_type=post',
17+
searchable: 2,
18+
quickSearch: 0,
19+
filterable: 0,
20+
headers: {
21+
'User-Agent': 'PC_UA',
22+
},
23+
class_name: '电影&电视剧&动漫',
24+
class_url: 'category/movie&category/airing&category/anime/new-bangumi',
25+
/*class_parse:async function () {
26+
let {pdfa,pdfh,pd} = this;
27+
let html =await request(rule.host,{
28+
headers: {
29+
'User-Agent': MOBILE_UA,
30+
// 'Cookie':'X_CACHE_KEY=7791d8c9a761b51365e524f94a3af24f;cf_clearance=QJy.5hM8B_sizwwOLwIEq5uQYdmI70G.bK_f8ez0_qI-1736495334-1.2.1.1-80gPwpLxtdQfr_HFCYZKzpeTL4LFVqdrmU.bw3X.57Nri3h7_T74oKHp7ZY6N8moX93fPBUi1mBaVD4Cla6PWLyJjiZriZJhgFQCoaNjDG_dy3v2.akBe0I_NG4zySGqfQcg2OS6yTvCr7nOHHJleZzhfnBOUV55g0hY53Y.0JOTjokDX2VJYDGBmGdUI4M0ZsbDha9m1q2R5doUrv.a29t1_PaeZ4vthayxR2vOqNsPO_R.glP4n9hatQzykhMKBpemNQlt5Sn7xTeT2EcdJXMttSpiUHABW725F4sDtEd9EaQAS1VAtRTG4kw4KjvK4Y_brvnf5DRSRH_ZGsqL.UDPxGAFdDfh9EX_bQJhwsMXgCkR9wvgdQB.tr7hymwiVYEXichdgzVosdkQ7TDq2g',
31+
// 'Priority':'u=0, i'
32+
},
33+
method:'GET'
34+
})
35+
log(html)
36+
let d = [];
37+
let data = pdfa(html, '#primary-menu li.menu-item');
38+
data.forEach((it) => {
39+
let id=pd(it, 'a&&href').match(/\.pro\/(.*)/)[1]
40+
log(id)
41+
d.push({
42+
type_name: pdfh(it, 'a&&Text'),
43+
type_id: id,
44+
})
45+
});
46+
log(d)
47+
return {
48+
class: d
49+
}
50+
},*/
51+
//class_parse: '#primary-menu li.menu-item;a&&Text;a&&href;\.pro/(.*)',
52+
//cate_exclude: '站长|^其他$|关于|^电影$|^剧集$|^类型$',
53+
double: false,
54+
play_parse: true,
55+
56+
lazy: async function () {
57+
let {input} = this
58+
return input
59+
},
60+
limit: 6,
61+
推荐: async function () {
62+
return []
63+
},
64+
一级: async function () {
65+
let {input, pdfa, pd, pdfh} = this;
66+
var d = [];
67+
var html = await request(input);
68+
// log(html);
69+
let list = pdfa(html, '.post-box-list&&article');
70+
list.forEach(it => {
71+
d.push({
72+
title: pdfh(it, 'a:eq(-1)&&Text'),
73+
img: pd(it, '.post-box-image&&style'),
74+
desc: pdfh(it, 'a:eq(0)&&Text'),
75+
url: pd(it, 'a:eq(-1)&&href'),
76+
})
77+
});
78+
return setResult(d);
79+
},
80+
//一级: '.post-box-list&&article;a:eq(-1)&&Text;.post-box-image&&style;a:eq(0)&&Text;a:eq(-1)&&href',
81+
二级: async function () {
82+
let {input, pdfa, pdfh} = this;
83+
let html = await request(input);
84+
let VOD = {};
85+
VOD.vod_name = pdfh(html, '.post-title&&Text');
86+
VOD.vod_content = pdfh(html, '.abstract&&Text');
87+
var playurls = [];
88+
var playfrom = [];
89+
let src = pdfh(html, ".wp-playlist-script&&Html");
90+
src = JSON.parse(src).tracks;
91+
src.forEach(it => {
92+
let purl = "https://v.ddys.pro" + it.src0;
93+
playfrom.push('播放');
94+
playurls.push(unescape(it.caption) + "$" + purl)
95+
})
96+
var plists = pdfa(html, '.entry&&p:has(a[href])')
97+
let p_1 = plists.map(v => pdfh(v, 'a&&title') + '$push://' + pdfh(v, 'a&&href')).filter(v => v.includes('uc'));
98+
playurls.push(p_1)
99+
let p_2 = plists.map(v => pdfh(v, 'a&&title') + '$push://' + pdfh(v, 'a&&href')).filter(v => v.includes('quark'));
100+
playurls.push(p_2)
101+
let tabs = ['UC网盘', '夸克网盘']
102+
playfrom.push(tabs)
103+
VOD.vod_play_from = playfrom.join("$$$")
104+
VOD.vod_play_url = playurls.join("$$$")
105+
return VOD
106+
},
107+
108+
搜索: async function () {
109+
let {
110+
input,
111+
pdfa,
112+
pdfh,
113+
pd
114+
} = this;
115+
let html = await request(input);
116+
let d = [];
117+
let data = pdfa(html, '#main&&article');
118+
data.forEach((it) => {
119+
d.push({
120+
title: pdfh(it, '.post-title&&Text'),
121+
pic_url: pd(it, '.post-box-image&&style'),
122+
desc: pdfh(it, '.published&&Text'),
123+
url: pd(it, 'a&&href')
124+
})
125+
});
126+
return setResult(d)
127+
}
128+
//搜索: '#main&&article;.post-title&&Text;;.published&&Text;a&&href'
129+
}

js/奇珍异兽[官].js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ var rule = {
173173
let html = await request(input);
174174
let json = JSON.parse(html);
175175
let data = pjfa(json, '.data.docinfos');
176-
log('data:', data);
176+
// log('data:', data);
177177
data.forEach((it) => {
178178
d.push({
179179
title: pjfh(it, '.albumDocInfo.albumTitle'),

js/好乐影视.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ var rule = {
22
类型: '影视',
33
title: '好乐影视',
44
host: 'https://www.haolev.com',
5-
url: '/haoshow/fyfilter.html',
5+
url: '/haoshow/fyfilter',
66
searchUrl: '/lesearch/**----------fypage---.html',
7-
headers: {'User-Agent': 'UC_UA'},
8-
searchable: 1, quickSearch: 0, filterable: 1, play_parse: true, double: false, play_parse: true, limit: 6,
7+
headers: {'User-Agent': 'MOBILE_UA'},
8+
searchable: 1, quickSearch: 0, filterable: 1, play_parse: true, double: false, limit: 6,
99
filter_url: '{{fl.cateId}}-{{fl.area}}-{{fl.by}}-{{fl.class}}-----fypage---{{fl.year}}.html',
1010
filter_def: {
1111
'1': {cateId: '1'}, '2': {cateId: '2'}, '3': {cateId: '3'}, '4': {cateId: '4'}

libs_drpy/drpyInject.js

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import axios, {toFormData} from 'axios';
22
import axiosX from './axios.min.js';
33
import crypto from 'crypto';
4+
import http from "http";
45
import https from 'https';
56
import fs from 'node:fs';
67
import qs from 'qs';
@@ -22,6 +23,54 @@ globalThis.axiosX = axiosX;
2223
globalThis.hlsParser = hlsParser;
2324
globalThis.qs = qs;
2425

26+
const AgentOption = {keepAlive: true, maxSockets: 64, timeout: 30000}; // 最大连接数64,30秒定期清理空闲连接
27+
const httpAgent = new http.Agent(AgentOption);
28+
let httpsAgent = new https.Agent({rejectUnauthorized: false, ...AgentOption});
29+
30+
// 配置 axios 使用代理
31+
const _axios = axios.create({
32+
httpAgent, // 用于 HTTP 请求的代理
33+
httpsAgent, // 用于 HTTPS 请求的代理
34+
});
35+
36+
// 请求拦截器
37+
_axios.interceptors.request.use((config) => {
38+
// 生成 curl 命令
39+
const curlCommand = generateCurlCommand(config);
40+
console.log(`Generated cURL command:\n${curlCommand}`);
41+
return config;
42+
}, (error) => {
43+
return Promise.reject(error);
44+
});
45+
46+
/**
47+
* 生成 curl 命令
48+
* @param {Object} config Axios 请求配置
49+
* @returns {string} curl 命令
50+
*/
51+
function generateCurlCommand(config) {
52+
const {method, url, headers, data} = config;
53+
let curlCommand = `curl -X ${method.toUpperCase()} '${url}'`;
54+
55+
// 添加 headers
56+
if (headers) {
57+
for (const [key, value] of Object.entries(headers)) {
58+
curlCommand += ` -H '${key}: ${value}'`;
59+
}
60+
}
61+
62+
// 添加 body 数据
63+
if (data) {
64+
if (typeof data === 'object') {
65+
curlCommand += ` -d '${JSON.stringify(data)}'`;
66+
} else {
67+
curlCommand += ` -d '${data}'`;
68+
}
69+
}
70+
71+
return curlCommand;
72+
}
73+
2574

2675
const confs = {};
2776

@@ -104,17 +153,16 @@ async function request(url, opt = {}) {
104153
}
105154

106155
// 配置代理或 HTTPS Agent
107-
const agent = proxy
108-
? tunnel.httpsOverHttp({proxy: {host: '127.0.0.1', port: 7890}})
109-
: new https.Agent({rejectUnauthorized: false});
156+
// httpsAgent = new https.Agent({rejectUnauthorized: false});
157+
const agent = proxy ? tunnel.httpsOverHttp({proxy: {host: '127.0.0.1', port: 7890}}) : httpsAgent;
110158

111159
// 设置响应类型为 arraybuffer,确保能正确处理编码
112160
const respType = returnBuffer ? 'arraybuffer' : 'arraybuffer';
113161

114162
console.log(`req: ${url} headers: ${JSON.stringify(headers)} data: ${JSON.stringify(data)}`);
115163
try {
116164
// 发送请求
117-
const resp = await axios({
165+
const resp = await _axios({
118166
url: typeof url === 'object' ? url.url : url,
119167
method,
120168
headers,

0 commit comments

Comments
 (0)