Skip to content

Commit 97490a8

Browse files
author
Taois
committed
feat: 发布新版本
1 parent 69af851 commit 97490a8

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed

scripts/mjs/qimao.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const url = 'https://www.qimao.com/shuku/0-a-a-a-a-a-a-click-1/';
2+
3+
try {
4+
const response = await fetch(url, {
5+
method: 'GET',
6+
headers: {
7+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
8+
'AppleWebKit/537.36 (KHTML, like Gecko) ' +
9+
'Chrome/139.0.0.0 Safari/537.36'
10+
}
11+
});
12+
13+
if (!response.ok) {
14+
throw new Error(`请求失败,状态码:${response.status}`);
15+
}
16+
17+
const html = await response.text();
18+
console.log(html); // 打印网页源码
19+
} catch (err) {
20+
console.error('请求出错:', err);
21+
}

spider/js/七猫小说[书].jsd renamed to spider/js/七猫小说[书].js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,42 @@ var rule = {
7474
},
7575
double: true,
7676
推荐: '',
77+
request: async function (url, obj) {
78+
obj = obj || {};
79+
try {
80+
const response = await _fetch(url, {
81+
method: obj.method || 'GET',
82+
headers: obj.headers || {
83+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
84+
'AppleWebKit/537.36 (KHTML, like Gecko) ' +
85+
'Chrome/139.0.0.0 Safari/537.36'
86+
}
87+
});
88+
return response.text();
89+
} catch (err) {
90+
return ''
91+
}
92+
},
7793
一级: async function () {
7894
let {input, pdfa, pdfh, pd} = this;
79-
let html = await request(input);
95+
let html = await this.request(input);
96+
// console.log('html:', html);
8097
let d = [];
81-
let data = pdfa(html, 'ul.qm-pic-txt&&li');
98+
let data = pdfa(html, 'ul.qm-cover-text&&li');
8299
data.forEach((it) => {
83100
d.push({
84-
title: pdfh(it, 'a:eq(-1)&&Text'),
101+
title: pdfh(it, '.s-tit&&Text'),
85102
pic_url: pd(it, 'img&&src'),
86-
desc: pdfh(it, '.s-name&&Text'),
103+
desc: pdfh(it, '.s-author&&Text'),
87104
url: pd(it, 'a&&href'),
88-
content: pdfh(it, '.s-des&&Text'),
105+
content: pdfh(it, '.s-desc&&Text'),
89106
})
90107
});
91108
return setResult(d)
92109
},
93110
二级: async function () {
94111
let {input, pdfa, pdfh, pd} = this;
95-
let html = await request(input);
112+
let html = await this.request(input);
96113
let VOD = {};
97114
VOD.vod_name = pdfh(html, 'span.txt&&Text');
98115
VOD.type_name = pdfh(html, '.qm-tag:eq(-1)&&Text');
@@ -110,7 +127,7 @@ var rule = {
110127
});
111128
// log(input);
112129
// log(listUrl);
113-
let html1 = await request(listUrl);
130+
let html1 = await this.request(listUrl);
114131
let json = JSON.parse(html1);
115132
let chapters = json.data.chapters;
116133
// log(chapters.length);
@@ -134,7 +151,7 @@ var rule = {
134151
params['sign'] = getSignStr(params);
135152
let _url = buildUrl(rule.searchUrl.split('#')[0], params);
136153
//log(_url);
137-
let html = await request(_url, {
154+
let html = await this.request(_url, {
138155
headers: rule.sign_headers
139156
});
140157
let json = JSON.parse(html);

0 commit comments

Comments
 (0)