other-emerald
other-emerald2y ago

EnqueueLInks

It is possible to add delay's in enqueueLinks? like before to crawl a certain URL I want to add some delay.
5 Replies
Lukas Krivka
Lukas Krivka2y ago
You can delay any request in the preNavigationHooks. Just keep in mind that Crawler is scaling concurrency based on the CPU utilization so it will not influence maxConcurrency
Pepa J
Pepa J2y ago
Hi @Banul; There is basic example to the Lukas's suggestion:
import { utils } from 'crawlee';

// ...

new PlaywrightCrawler({
// ....
preNavigationHooks: [
async (context) => {
await utils.sleep(10_000);
},
],
// ...
});
import { utils } from 'crawlee';

// ...

new PlaywrightCrawler({
// ....
preNavigationHooks: [
async (context) => {
await utils.sleep(10_000);
},
],
// ...
});
other-emerald
other-emeraldOP2y ago
hmm does cheerioocrawler has a preNavigationHooks?
other-emerald
other-emeraldOP2y ago
Oh I didn't see this. Thanks for this I thought preNavigationHooks option is only for PlaywrightCrawler. Again Thank you !

Did you find this page helpful?