Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed May 27, 2024
1 parent 4feadb5 commit d31baac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ const initializeCrawler = async () => {
}
});

//sleep(60000);
await Promise.race([
page.waitForNetworkIdle({ idleTime: 500, concurrency: 3 }),
new Promise((_, reject) =>
setTimeout(() => reject(new Error("Timeout")), 10000),
),
]);

await page.evaluate(() => {
return window.scrollBy(0, window.innerHeight);
Expand All @@ -53,7 +58,7 @@ const initializeCrawler = async () => {
console.log(`Title: ${await page.title()}`);
console.log(`Content: ${content}`);
contentMap.set(request.uniqueKey, content); // Store content with uniqueKey
//await requestQueue.markRequestHandled(request);
await requestQueue.markRequestHandled(request);
},
});

Expand Down

0 comments on commit d31baac

Please sign in to comment.