Skip to content

Commit

Permalink
feat: 增加了对小众软件论坛的支持(https://linux.do/t/topic/169209/166
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Aug 7, 2024
1 parent 923fd74 commit 598913c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
.env.local
.env.local*
screenshots
27 changes: 19 additions & 8 deletions bypasscf.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,20 @@ async function launchBrowserForUser(username, password) {
page.on("load", async () => {
// await page.evaluate(externalScript); //因为这个是在页面加载好之后执行的,而脚本是在页面加载好时刻来判断是否要执行,由于已经加载好了,脚本就不会起作用
});
await page.goto("https://linux.do/t/topic/13716/285", {
waitUntil: "domcontentloaded",
});
// 如果是Linuxdo,就导航到我的帖子
if (loginUrl == "https://linux.do") {
await page.goto("https://linux.do/t/topic/13716/340", {
waitUntil: "domcontentloaded",
});
} else if (loginUrl == "https://meta.appinn.net") {
await page.goto("https://meta.appinn.net/t/topic/52006", {
waitUntil: "domcontentloaded",
});
} else {
await page.goto(`${loginUrl}/t/topic/1`, {
waitUntil: "domcontentloaded",
});
}
} catch (err) {
console.log(err);
}
Expand All @@ -192,10 +203,10 @@ async function login(page, username, password) {
console.log("Login button not found.");
}
});
if (!loginButton) {
await page.goto(`${loginUrl}/t/topic/1`, { waitUntil: "domcontentloaded" });
await page.click(".discourse-reactions-reaction-button");
}
// if (!loginButton) {
// await page.goto(`${loginUrl}/t/topic/1`, { waitUntil: "domcontentloaded" });
// await page.click(".discourse-reactions-reaction-button");
// }
// 等待用户名输入框加载
await page.waitForSelector("#login-account-name");
// 模拟人类在找到输入框后的短暂停顿
Expand Down Expand Up @@ -257,7 +268,7 @@ async function navigatePage(url, page, browser) {
await browser.close();
return; // 超时则退出函数
}
}
}
console.log("页面标题:", pageTitle);
}

Expand Down
2 changes: 2 additions & 0 deletions external.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@
// 如果是Linuxdo,就导航到我的帖子
if (BASE_URL == "https://linux.do") {
window.location.href = "https://linux.do/t/topic/13716/340";
} else if (BASE_URL == "https://meta.appinn.net") {
window.location.href = "https://meta.appinn.net/t/topic/52006";
} else {
window.location.href = `${BASE_URL}/t/topic/1`;
}
Expand Down
2 changes: 2 additions & 0 deletions index_passage_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@
// 如果是Linuxdo,就导航到我的帖子
if (BASE_URL == "https://linux.do") {
window.location.href = "https://linux.do/t/topic/13716/340";
} else if (BASE_URL == "https://meta.appinn.net") {
window.location.href = "https://meta.appinn.net/t/topic/52006";
} else {
window.location.href = `${BASE_URL}/t/topic/1`;
}
Expand Down

0 comments on commit 598913c

Please sign in to comment.