Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

晋江和长佩更新 #657

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
} from "./setting";
import { failedPlus, printStat, successPlus } from "./stat";
import { ProgressVM, vm as progress } from "./ui/progress";
import { setStreamSaverSetting } from "./lib/zip";

Check warning on line 20 in src/rules.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'setStreamSaverSetting' is defined but never used

interface BcMessage {
type: "ping" | "pong" | "close";
Expand Down Expand Up @@ -248,6 +248,7 @@
(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) {
Expand All @@ -265,6 +266,8 @@
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) {
Expand Down
12 changes: 6 additions & 6 deletions src/rules/special/original/gongzicp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class Gongzicp extends BaseRuleClass {
super();
this.attachmentMode = "TM";
this.concurrencyLimit = 1;
this.maxRunLimit = 1;
}

public async bookParse() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand All @@ -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();
}
Expand Down Expand Up @@ -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秒,反反爬
Expand Down
4 changes: 4 additions & 0 deletions src/rules/special/original/jjwxc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import * as csstree from "css-tree";
import * as CryptoJS from "crypto-js";

type JJWindow = UnsafeWindow & { getCookie: (key: string) => string };

Check warning on line 26 in src/rules/special/original/jjwxc.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'JJWindow' is defined but never used

export class Jjwxc extends BaseRuleClass {
public constructor() {
Expand Down Expand Up @@ -183,6 +183,8 @@
options: {},
});
const isLogin = () => {
if (typeof (unsafeWindow as UnsafeWindow).tokenOptions === "object")
return true;
return !document.getElementById("jj_login");
};
if (isVIP() && !isLogin()) {
Expand All @@ -209,6 +211,8 @@
options: {},
});
const isLogin = () => {
if (typeof (unsafeWindow as UnsafeWindow).tokenOptions === "object")
return true;
return !document.getElementById("jj_login");
};
if (isVIP() && !isLogin()) {
Expand Down Expand Up @@ -259,7 +263,7 @@
charset: string,
options: object
) {
async function publicChapter(): Promise<ChapterParseObject> {

Check warning on line 266 in src/rules/special/original/jjwxc.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'publicChapter' is defined but never used
const doc = await getHtmlDOM(chapterUrl, charset);
chapterName = (
doc.querySelector("div.noveltext h2") as HTMLElement
Expand Down Expand Up @@ -867,7 +871,7 @@
additionalMetadate: null,
};
}
interface vipChapterInfo {

Check warning on line 874 in src/rules/special/original/jjwxc.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'vipChapterInfo' is defined but never used
downloadContent: ChapterInfo[];
}
interface ChapterInfo {
Expand All @@ -891,7 +895,7 @@
let v43, v38, dest;
let accesskey = "accesskey", keyString = "keystring";
const arr = responseHeader.trim().split(/[\r\n]+/);
const headerMap = { "accesskey": "0", "keystring": "0" };

Check warning on line 898 in src/rules/special/original/jjwxc.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'headerMap' is assigned a value but never used
arr.forEach((line) => {
const parts = line.split(": ");
const header = parts.shift();
Expand Down Expand Up @@ -953,7 +957,7 @@
return decrypted.toString(CryptoJS.enc.Utf8);
}

function getCookieObj(pairKey: string) {

Check warning on line 960 in src/rules/special/original/jjwxc.ts

View workflow job for this annotation

GitHub Actions / build-and-deploy

'getCookieObj' is defined but never used
const cookieStr = document.cookie;
const pairList = cookieStr.split(";");
for (let _i = 0, pairList_1 = pairList; _i < pairList_1.length; _i++) {
Expand Down
Loading