@@ -165,9 +165,20 @@ async function launchBrowserForUser(username, password) {
165
165
page . on ( "load" , async ( ) => {
166
166
// await page.evaluate(externalScript); //因为这个是在页面加载好之后执行的,而脚本是在页面加载好时刻来判断是否要执行,由于已经加载好了,脚本就不会起作用
167
167
} ) ;
168
- await page . goto ( "https://linux.do/t/topic/13716/285" , {
169
- waitUntil : "domcontentloaded" ,
170
- } ) ;
168
+ // 如果是Linuxdo,就导航到我的帖子
169
+ if ( loginUrl == "https://linux.do" ) {
170
+ await page . goto ( "https://linux.do/t/topic/13716/340" , {
171
+ waitUntil : "domcontentloaded" ,
172
+ } ) ;
173
+ } else if ( loginUrl == "https://meta.appinn.net" ) {
174
+ await page . goto ( "https://meta.appinn.net/t/topic/52006" , {
175
+ waitUntil : "domcontentloaded" ,
176
+ } ) ;
177
+ } else {
178
+ await page . goto ( `${ loginUrl } /t/topic/1` , {
179
+ waitUntil : "domcontentloaded" ,
180
+ } ) ;
181
+ }
171
182
} catch ( err ) {
172
183
console . log ( err ) ;
173
184
}
@@ -192,10 +203,10 @@ async function login(page, username, password) {
192
203
console . log ( "Login button not found." ) ;
193
204
}
194
205
} ) ;
195
- if ( ! loginButton ) {
196
- await page . goto ( `${ loginUrl } /t/topic/1` , { waitUntil : "domcontentloaded" } ) ;
197
- await page . click ( ".discourse-reactions-reaction-button" ) ;
198
- }
206
+ // if (!loginButton) {
207
+ // await page.goto(`${loginUrl}/t/topic/1`, { waitUntil: "domcontentloaded" });
208
+ // await page.click(".discourse-reactions-reaction-button");
209
+ // }
199
210
// 等待用户名输入框加载
200
211
await page . waitForSelector ( "#login-account-name" ) ;
201
212
// 模拟人类在找到输入框后的短暂停顿
@@ -257,7 +268,7 @@ async function navigatePage(url, page, browser) {
257
268
await browser . close ( ) ;
258
269
return ; // 超时则退出函数
259
270
}
260
- }
271
+ }
261
272
console . log ( "页面标题:" , pageTitle ) ;
262
273
}
263
274
0 commit comments