@cloud411716/fancy-webnovel 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,34 +5,31 @@
|
|
|
5
5
|
* pageContext JSON,绕过了服务端渲染的加密,直接提取书籍数据。
|
|
6
6
|
* 无需 Playwright。
|
|
7
7
|
*
|
|
8
|
-
* Rank paths (mobile):
|
|
9
|
-
* /rank/
|
|
10
|
-
* /rank/
|
|
11
|
-
* /rank/
|
|
12
|
-
* /rank/
|
|
13
|
-
* /rank/1_5173_31 新人作者新书榜
|
|
8
|
+
* Rank paths (mobile, slug-based):
|
|
9
|
+
* /rank/hotsales/ 畅销榜
|
|
10
|
+
* /rank/yuepiao/ 月票榜
|
|
11
|
+
* /rank/newbook/ 新书榜
|
|
12
|
+
* /rank/newauthor/ 新人作者榜
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
const MOBILE_BASE = 'https://m.qidian.com';
|
|
17
16
|
|
|
18
|
-
//
|
|
17
|
+
// rank.id → URL slug, matches RANK_PATHS keys used by scrapeRank()
|
|
19
18
|
const RANK_PATHS = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'5173_31': '/rank/1_5173_31',
|
|
19
|
+
hotsales: '/rank/hotsales/',
|
|
20
|
+
yuepiao: '/rank/yuepiao/',
|
|
21
|
+
newbook: '/rank/newbook/',
|
|
22
|
+
newauthor: '/rank/newauthor/',
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
export const platform = 'qidian';
|
|
28
26
|
export const label = '起点';
|
|
29
27
|
|
|
30
28
|
export const rankList = [
|
|
31
|
-
{ id: '
|
|
32
|
-
{ id: '
|
|
33
|
-
{ id: '
|
|
34
|
-
{ id: '
|
|
35
|
-
{ id: '5173_31', label: '新人作者新书榜', channel: '1', type: '5173_31' },
|
|
29
|
+
{ id: 'hotsales', label: '畅销榜', channel: '1', type: 'hotsales' },
|
|
30
|
+
{ id: 'yuepiao', label: '月票榜', channel: '1', type: 'yuepiao' },
|
|
31
|
+
{ id: 'newbook', label: '新书榜', channel: '1', type: 'newbook' },
|
|
32
|
+
{ id: 'newauthor', label: '新人作者榜', channel: '1', type: 'newauthor' },
|
|
36
33
|
];
|
|
37
34
|
|
|
38
35
|
const HEADERS = {
|
|
@@ -73,15 +70,13 @@ export async function scrapeRank(rankId, ctx, signal) {
|
|
|
73
70
|
if (!records.length) return { ok: false, books: [], error: 'no book records found' };
|
|
74
71
|
|
|
75
72
|
const books = records.map((r) => ({
|
|
76
|
-
rank:
|
|
77
|
-
title:
|
|
78
|
-
author:
|
|
79
|
-
category:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
cover: r.cover ?? '',
|
|
84
|
-
bookId: r.bookId ?? '',
|
|
73
|
+
rank: r.rankNum ?? 0,
|
|
74
|
+
title: r.bName ?? '',
|
|
75
|
+
author: r.bAuth ?? '',
|
|
76
|
+
category: r.cat ?? '',
|
|
77
|
+
words: r.cnt ?? '0',
|
|
78
|
+
intro: (r.desc ?? '').slice(0, 150),
|
|
79
|
+
bookId: r.bid ?? '',
|
|
85
80
|
}));
|
|
86
81
|
|
|
87
82
|
return { ok: true, books };
|
package/commands/scan/scraper.js
CHANGED