mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
when arrive the terminal of the recommend job list, reload page and continue trying to find except job
This commit is contained in:
+13
-1
@@ -50,7 +50,7 @@ async function mainLoop () {
|
||||
const recommendJobLink = (await page.$('[ka=header-job-recommend]'))
|
||||
await recommendJobLink.click()
|
||||
|
||||
while (true) {
|
||||
afterPageLoad: while (true) {
|
||||
await sleepWithRandomDelay(3000)
|
||||
|
||||
const expectJobList = (await page.evaluate(`
|
||||
@@ -75,6 +75,7 @@ async function mainLoop () {
|
||||
);
|
||||
await sleepWithRandomDelay(2000)
|
||||
|
||||
try {
|
||||
const { targetJobElProxy, targetJobIndex } = await new Promise(async (resolve, reject) => {
|
||||
// job list
|
||||
const recommendJobListElProxy = await page.$('.job-list-container .rec-job-list')
|
||||
@@ -205,6 +206,17 @@ async function mainLoop () {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof Error && err.message === 'CANNOT_FIND_EXCEPT_JOB') {
|
||||
await Promise.all([
|
||||
page.reload(),
|
||||
page.waitForNavigation()
|
||||
])
|
||||
continue afterPageLoad;
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ;await browser.close()
|
||||
|
||||
Reference in New Issue
Block a user