Skip to content

Commit f29420d

Browse files
author
Taois
committed
fix:some source
1 parent 5329270 commit f29420d

File tree

3 files changed

+305
-27
lines changed

3 files changed

+305
-27
lines changed

spider/catvod/番茄漫画[画].js

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
/*
2+
@header({
3+
searchable: 1,
4+
filterable: 0,
5+
quickSearch: 0,
6+
title: '番茄漫画',
7+
'类型': '漫画',
8+
lang: 'ds'
9+
})
10+
*/
11+
import cheerio from 'assets://js/lib/cheerio.min.js';
12+
13+
let HOST = 'https://qkfqapi.vv9v.cn';
14+
let UA = {
15+
"User-Agent": "Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36"
16+
};
17+
18+
async function request(url, obj) {
19+
if (!obj) {
20+
obj = {
21+
headers: UA,
22+
timeout: 5000
23+
}
24+
}
25+
const response = await req(url, obj);
26+
return response.content;
27+
}
28+
29+
function init(cfg) {
30+
const ext = cfg.ext;
31+
console.log('番茄漫画源初始化');
32+
console.log('初始化完成');
33+
}
34+
35+
async function home(filter) {
36+
try {
37+
let html = await request('https://qkfqapi.vv9v.cn/api/discover/style?tab=漫画&source_type=男频');
38+
let json = JSON.parse(html);
39+
let data = json.data;
40+
let d = [];
41+
data.forEach((it) => {
42+
if (it.url && it.url.trim() !== '') {
43+
d.push({
44+
type_name: it.title,
45+
type_id: it.url,
46+
});
47+
}
48+
});
49+
return JSON.stringify({
50+
'class': d
51+
});
52+
} catch (error) {
53+
console.log('home函数错误:', error);
54+
}
55+
}
56+
57+
58+
async function homeVod(params) {
59+
try {
60+
let url = HOST + '/api/discover?tab=漫画&type=7&gender=2&genre_type=110&page=1';
61+
let html = await request(url);
62+
let json = JSON.parse(html);
63+
64+
if (json && json.data) {
65+
let data = json.data.data || json.data;
66+
let d = [];
67+
68+
data.forEach((item) => {
69+
if (item && item.book_name) {
70+
d.push({
71+
vod_name: item.book_name,
72+
vod_id: item.book_id || item.id,
73+
vod_pic: item.thumb_url || item.cover,
74+
vod_remarks: item.author || item.category || '',
75+
vod_content: item.abstract || item.description || ''
76+
});
77+
}
78+
});
79+
80+
return JSON.stringify({
81+
list: d
82+
});
83+
}
84+
} catch (error) {
85+
console.log('首页推荐请求错误:', error);
86+
}
87+
}
88+
89+
async function category(tid, pg, filter, extend) {
90+
try {
91+
let url = tid;
92+
let html = await request(url);
93+
let json = JSON.parse(html);
94+
95+
if (json && json.data) {
96+
let data = json.data.data || json.data;
97+
let d = [];
98+
99+
data.forEach((item) => {
100+
if (item && item.book_name) {
101+
d.push({
102+
vod_name: item.book_name,
103+
vod_id: item.book_id || item.id,
104+
vod_pic: item.thumb_url || item.cover,
105+
vod_remarks: item.author || item.category || '',
106+
vod_content: item.abstract || item.description || ''
107+
});
108+
}
109+
});
110+
111+
if (d.length > 0) {
112+
return JSON.stringify({
113+
list: d,
114+
page: pg,
115+
pagecount: 999,
116+
limit: 20,
117+
total: 999
118+
});
119+
}
120+
}
121+
} catch (error) {
122+
console.log('分类请求错误:', error);
123+
}
124+
}
125+
126+
async function detail(vod_url) {
127+
try {
128+
let detailUrl = HOST + '/api/detail?book_id=' + vod_url;
129+
let json = JSON.parse(await request(detailUrl));
130+
131+
if (json?.data?.data) {
132+
let data = json.data.data;
133+
let vod = {
134+
vod_name: data.book_name || '',
135+
vod_id: vod_url,
136+
type_name: data.category || '',
137+
vod_pic: data.thumb_url || '',
138+
vod_content: data.abstract || '',
139+
vod_remarks: data.sub_info || '',
140+
vod_director: data.author || '',
141+
vod_play_from: '番茄漫画',
142+
vod_play_url: ''
143+
};
144+
145+
let chapterUrl = HOST + '/api/book?book_id=' + vod_url;
146+
let chapterJson = JSON.parse(await request(chapterUrl));
147+
if (chapterJson?.data?.data) {
148+
let bookInfo = chapterJson.data.data;
149+
let list = bookInfo.chapterListWithVolume.flat();
150+
151+
let urls = [];
152+
list.forEach((it) => {
153+
if (it && it.title && it.itemId) {
154+
urls.push(it.title + '$' + it.itemId + '@' + it.title);
155+
}
156+
});
157+
vod.vod_play_url = urls.join('#');
158+
}
159+
160+
return JSON.stringify({list: [vod]});
161+
}
162+
} catch (error) {
163+
console.log('详情请求错误:', error);
164+
}
165+
}
166+
167+
async function play(flag, id, flags) {
168+
try {
169+
let itemId = id;
170+
let title = '';
171+
172+
if (id.includes('@')) {
173+
let parts = id.split('@');
174+
itemId = parts[0];
175+
title = parts[1] || '';
176+
}
177+
178+
let url = HOST + '/api/content?tab=漫画&item_id=' + itemId + '&show_html=0';
179+
let html = await request(url);
180+
let json = JSON.parse(html);
181+
let images = json.data.images;
182+
images = pdfa(images, 'img');
183+
let pics = [];
184+
images.forEach((img) => {
185+
let pic = pdfh(img, 'img&&src');
186+
pics.push(pic);
187+
});
188+
189+
if (pics.length > 0) {
190+
return JSON.stringify({
191+
parse: 0,
192+
url: 'pics://' + pics.join('&&')
193+
});
194+
}
195+
} catch (error) {
196+
console.log('播放 请求错误:', error);
197+
}
198+
}
199+
200+
async function search(wd, quick) {
201+
try {
202+
let searchUrl = HOST + '/api/search?key=' + encodeURIComponent(wd) + '&tab_type=8&offset=0';
203+
let html = await request(searchUrl);
204+
let json = JSON.parse(html);
205+
206+
if (json && json.data) {
207+
let searchTabs = json.data.search_tabs || [];
208+
let bookList = [];
209+
210+
if (searchTabs.length > 3 && searchTabs[3].data) {
211+
bookList = searchTabs[3].data;
212+
} else if (json.data.data) {
213+
bookList = json.data.data;
214+
}
215+
216+
let d = [];
217+
bookList.forEach((item) => {
218+
let book = item.book_data ? item.book_data[0] : item;
219+
if (book && book.book_name) {
220+
d.push({
221+
vod_name: book.book_name,
222+
vod_id: book.book_id,
223+
vod_pic: book.thumb_url || '',
224+
vod_remarks: book.author || '',
225+
vod_content: book.book_abstract || book.abstract || ''
226+
});
227+
}
228+
});
229+
230+
return JSON.stringify({
231+
list: d
232+
});
233+
}
234+
} catch (error) {
235+
console.log('搜索请求错误:', error);
236+
}
237+
}
238+
239+
function proxy(params) {
240+
return [200, 'text/plain;charset=utf-8', '番茄漫画源代理测试', null];
241+
}
242+
243+
export default {
244+
init: init,
245+
home: home,
246+
homeVod: homeVod,
247+
category: category,
248+
detail: detail,
249+
play: play,
250+
search: search,
251+
proxy: proxy,
252+
}

spider/js/番茄漫画[画].js

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ var rule = {
1313
类型: '漫画',
1414
title: '番茄漫画',
1515
host: 'https://qkfqapi.vv9v.cn',
16-
url: '',
16+
homeUrl: '/api/discover/style?tab=漫画',
17+
url: 'fyclass',
1718
searchUrl: '/api/search?key=**&tab_type=8&offset=((fypage-1)*10)',
1819
detailUrl: '/api/detail?book_id=fyid',
1920
headers: {'User-Agent': 'UC_UA'},
@@ -22,11 +23,19 @@ var rule = {
2223
filterable: 0,
2324
double: true,
2425
play_parse: true,
25-
limit: 12,
26-
// class_parse: async function () {
27-
// let {input, pdfa, pdfh, pd} = this;
28-
// return {}
29-
// },
26+
limit: 10,
27+
class_parse: async function () {
28+
let {input} = this;
29+
let html = await request(input);
30+
let data = html.parseX.data;
31+
let d = data.filter(item => item.url.trim()).map((it) => {
32+
return {
33+
type_name: it.title,
34+
type_id: it.url,
35+
}
36+
});
37+
return {class: d}
38+
},
3039
lazy: async function () {
3140
let {input, pdfa, pdfh} = this;
3241
let title = input.split('@')[1];
@@ -42,24 +51,38 @@ var rule = {
4251
}
4352
return {parse: 0, url: 'pics://' + pics.join('&&')}
4453
},
54+
parseList(html) {
55+
let data = html.parseX.data;
56+
data = data.data || data;
57+
let d = [];
58+
data.forEach((item) => {
59+
if (item && item.book_name) {
60+
d.push({
61+
vod_name: item.book_name,
62+
vod_id: item.book_id || item.id,
63+
vod_pic: item.thumb_url || item.cover,
64+
vod_remarks: item.author || item.category || '',
65+
vod_content: item.abstract || item.description || ''
66+
});
67+
}
68+
});
69+
return d
70+
},
4571
推荐: async function () {
46-
return [{
47-
vod_id: 'only_search',
48-
vod_name: '纯搜索源哦!',
49-
vod_tag: 'action',
50-
vod_pic: this.publicUrl + '/images/icon_cookie/搜索.jpg'
51-
}];
72+
let {HOST} = this;
73+
let url = HOST + '/api/discover?tab=漫画&type=7&gender=2&genre_type=110&page=1';
74+
let html = await request(url);
75+
return this.parseList(html);
5276
},
53-
一级: async function () {
54-
return [];
77+
一级: async function (tid, pg, filter, extend) {
78+
input = jinja.render(tid, {page: pg});
79+
let html = await request(input);
80+
return this.parseList(html);
5581
},
5682
二级: async function () {
5783
let {input, orId} = this;
58-
// log('input', input);
59-
// log('orId', orId);
6084
let html = await request(input);
61-
let json = JSON.parse(html);
62-
let data = json.data.data;
85+
let data = html.parseX.data.data;
6386
let VOD = {};
6487
VOD.vod_name = data.book_name;
6588
VOD.type_name = data.category;
@@ -83,10 +106,6 @@ var rule = {
83106
},
84107
搜索: async function () {
85108
let {input, MY_PAGE} = this;
86-
// if (Number(MY_PAGE) > 1) {
87-
// return []
88-
// }
89-
print(input)
90109
let html = await request(input);
91110
let json = JSON.parse(html);
92111
let data = json.data.search_tabs[3].data;
@@ -104,9 +123,4 @@ var rule = {
104123
}
105124
return setResult(d)
106125
},
107-
action: async function (action, value) {
108-
if (action === 'only_search') {
109-
return '此源为纯搜索源,你直接全局搜索这个源或者使用此页面的源内搜索就好了'
110-
}
111-
}
112126
}

spider/js/阅读助手[书].js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
@header({
3+
searchable: 2,
4+
filterable: 1,
5+
quickSearch: 0,
6+
title: '阅读助手[书]',
7+
author: 'EylinSir',
8+
'类型': '小说',
9+
lang: 'ds'
10+
})
11+
*/
12+
113
var rule = {
214
类型: '小说',
315
author: 'EylinSir',

0 commit comments

Comments
 (0)