From 35a7f9f0e0ebc01869204a0c48c3fec53f40fcb5 Mon Sep 17 00:00:00 2001 From: ldm2060 Date: Mon, 16 Sep 2024 15:10:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=99=8B=E6=B1=9F=E5=90=AF=E7=94=A8token?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=86=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=99=BB=E5=BD=95web=E7=89=88=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rules/special/original/jjwxc.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rules/special/original/jjwxc.ts b/src/rules/special/original/jjwxc.ts index 4950bb6d..eeac9b33 100644 --- a/src/rules/special/original/jjwxc.ts +++ b/src/rules/special/original/jjwxc.ts @@ -183,6 +183,8 @@ export class Jjwxc extends BaseRuleClass { options: {}, }); const isLogin = () => { + if (typeof (unsafeWindow as UnsafeWindow).tokenOptions === "object") + return true; return !document.getElementById("jj_login"); }; if (isVIP() && !isLogin()) { @@ -209,6 +211,8 @@ export class Jjwxc extends BaseRuleClass { options: {}, }); const isLogin = () => { + if (typeof (unsafeWindow as UnsafeWindow).tokenOptions === "object") + return true; return !document.getElementById("jj_login"); }; if (isVIP() && !isLogin()) { From 893e885f8bc49d5214896a58f1c53693ec510f10 Mon Sep 17 00:00:00 2001 From: ldm2060 Date: Mon, 16 Sep 2024 15:40:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=95=BF=E4=BD=A9?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=EF=BC=8C=E5=AF=B9=E4=BA=8E=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E7=BD=91=E7=AB=99=E5=B0=86=E9=9A=8F=E7=9D=80=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E7=9A=84=E8=BF=9B=E8=A1=8C=E5=A2=9E=E5=8A=A0=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=AF=B7=E6=B1=82=E6=97=B6=E9=97=B4=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rules.ts | 3 +++ src/rules/special/original/gongzicp.ts | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rules.ts b/src/rules.ts index fc49e2c6..1962bdc5 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -248,6 +248,7 @@ export abstract class BaseRuleClass { (progress as ProgressVM).totalChapterNumber = chapters.length; if (self.concurrencyLimit === 1) { + let chapteri = -1; for (const chapter of chapters) { if ((window as GmWindow).failedCount > 10) { if (!(window as GmWindow).stopFlag.aborted) { @@ -265,6 +266,8 @@ export abstract class BaseRuleClass { throw new ExpectError("[chapter]收到停止信号,停止继续下载。"); } try { + chapteri++; + await sleep(chapteri * 100 +Math.round(Math.random() * 1000)); let chapterObj = await chapter.init(); chapterObj = await postChapterParseHook(chapterObj, saveBookObj); } catch (error) { diff --git a/src/rules/special/original/gongzicp.ts b/src/rules/special/original/gongzicp.ts index c7954818..a23206d7 100644 --- a/src/rules/special/original/gongzicp.ts +++ b/src/rules/special/original/gongzicp.ts @@ -15,6 +15,7 @@ export class Gongzicp extends BaseRuleClass { super(); this.attachmentMode = "TM"; this.concurrencyLimit = 1; + this.maxRunLimit = 1; } public async bookParse() { @@ -341,7 +342,6 @@ export class Gongzicp extends BaseRuleClass { } else if (chapterObj.type === "item") { const chapterUrl = [ document.location.origin, - "v4", `read-${chapterObj.id}.html`, ].join("/"); const chapterNumber = parseInt(chapterObj.order); @@ -535,11 +535,11 @@ export class Gongzicp extends BaseRuleClass { headers: { Accept: "application/json, text/plain, */*", Client: "pc", - "Content-Type": "application/json;charset=utf-8", + "Content-Type": "application/json", }, referrer: chapterUrl, method: "GET", - mode: "cors", + //mode: "cors", }) .then((resp) => resp.json()) .catch((error) => log.error(error)); @@ -555,8 +555,8 @@ export class Gongzicp extends BaseRuleClass { } log.warn("[chapter]疑似被阻断,进行随机翻页……"); - const ci = Math.round(Math.random() * retryTime) + 1; - for (let i = 0; i < ci; i++) { + const walkerTime = Math.round(Math.random() * retryTime) + 1; + for (let i = 0; i < walkerTime; i++) { await sleep(3000 + Math.round(Math.random() * 5000)); randomWalker(); } @@ -672,7 +672,7 @@ export class Gongzicp extends BaseRuleClass { async function antiAntiCrawler() { // 随机游走,对抗阿里云验证码 // https://help.aliyun.com/document_detail/122071.html - if (Math.random() < 0.15) { + if (Math.random() < 0.2) { randomWalker(); } // 随机休眠3-7秒,反反爬