xenial-black
xenial-black2y 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);
},
],
// ...
});
xenial-black
xenial-blackOP2y ago
hmm does cheerioocrawler has a preNavigationHooks?
xenial-black
xenial-blackOP2y 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?