@cloud411716/fancy-webnovel 0.2.6 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -275,6 +275,13 @@ async function scrapeChannel(ch, type) {
275
275
  const context = await browser.newContext();
276
276
  const page = await context.newPage();
277
277
 
278
+ // CDP 强制窗口最大化
279
+ try {
280
+ const cdp = await context.newCDPSession(page);
281
+ const { windowId } = await cdp.send('Browser.getWindowForTarget', { target: page.target() });
282
+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { state: 'maximized' } });
283
+ } catch (_) {}
284
+
278
285
  let scraped = null;
279
286
 
280
287
  try {
@@ -116,6 +116,13 @@ async function scrapeRank(rankTypeId, channelId) {
116
116
  const context = await browser.newContext();
117
117
  const page = await context.newPage();
118
118
 
119
+ // CDP 强制窗口最大化
120
+ try {
121
+ const cdp = await context.newCDPSession(page);
122
+ const { windowId } = await cdp.send('Browser.getWindowForTarget', { target: page.target() });
123
+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { state: 'maximized' } });
124
+ } catch (_) {}
125
+
119
126
  let data = null;
120
127
  try {
121
128
  await page.goto(url, { waitUntil: "networkidle" });
@@ -112,6 +112,13 @@ async function scrapeRank(channelId, rankTypeId, periodId) {
112
112
  const context = await browser.newContext();
113
113
  const page = await context.newPage();
114
114
 
115
+ // CDP 强制窗口最大化
116
+ try {
117
+ const cdp = await context.newCDPSession(page);
118
+ const { windowId } = await cdp.send('Browser.getWindowForTarget', { target: page.target() });
119
+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { state: 'maximized' } });
120
+ } catch (_) {}
121
+
115
122
  let books, urls, rawCount;
116
123
  try {
117
124
  await page.goto(url, { waitUntil: "networkidle" });
@@ -65,6 +65,13 @@ async function scrapeBoard(board) {
65
65
  const context = await browser.newContext();
66
66
  const page = await context.newPage();
67
67
 
68
+ // CDP 强制窗口最大化
69
+ try {
70
+ const cdp = await context.newCDPSession(page);
71
+ const { windowId } = await cdp.send('Browser.getWindowForTarget', { target: page.target() });
72
+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { state: 'maximized' } });
73
+ } catch (_) {}
74
+
68
75
  try {
69
76
  await page.goto(ENTRY_URL, { waitUntil: "networkidle" });
70
77
 
@@ -105,7 +105,9 @@ export const scan = {
105
105
  `2. 分析爆款书籍的题材、卖点、节奏、人设等特征`,
106
106
  `3. 生成扫榜报告(包含:市场趋势、热门题材分析、用户画像、竞争度评估)`,
107
107
  `4. 给出 3-5 个可行的选题方向建议`,
108
- `5. 将完整分析报告追加写入:${topicFile}`,
108
+ `5. 将分析报告追加写入文件:\n` +
109
+ ` echo "你的报告内容" >> ${topicFile}\n` +
110
+ ` (使用 tee -a 或 >> ,不要覆盖现有内容)`,
109
111
  ``,
110
112
  `报告要求:`,
111
113
  `- 客观分析数据,不臆测`,