mo0n7
07/17/2025, 8:11 PMimport { RequestQueue } from "crawlee";
let jobQueue: RequestQueue;
async function initializeJobQueue() {
if (!jobQueue) {
jobQueue = await RequestQueue.open("job-deduplication-queue");
}
}
async function fetchJobPages(page: Page, jobIds: string[], origin: string) {
await initializeJobQueue();
const filteredJobIds = [];
if (saveOnlyUniqueItems) {
for (const jobId of jobIds) {
const jobUrl = `${origin}/viewjob?jk=${jobId}`;
const request = await jobQueue.addRequest({ url: jobUrl });
if (!request.wasAlreadyPresent) filteredJobIds.push(jobId);
}
} else {
filteredJobIds.push(...jobIds);
}
myLog(
`Filtered ${jobIds.length - filteredJobIds.length} duplicates, ` +
`processing ${filteredJobIds.length} unique jobs.`
);
// fetchJobWithRetry and batching logic follows...
}
Am i using the request correctly, I am not using the default one from the crawler because my scrapping logic does not allow it.Answer Overflow
07/17/2025, 8:11 PMmo0n7
07/17/2025, 9:37 PMmo0n7
07/17/2025, 9:39 PMmo0n7
07/17/2025, 9:40 PMthenetaji
07/18/2025, 3:25 PMmo0n7
07/19/2025, 3:01 PMApifyBot
07/19/2025, 3:01 PMcelnarapify
07/22/2025, 2:21 PMmo0n7
07/22/2025, 2:50 PMcelnarapify
07/23/2025, 8:39 AMuseExtendedUniqueKey or uniqueKey when enqueuing new request.
You can get more info about these here https://crawlee.dev/js/api/core/interface/RequestOptions#useExtendedUniqueKey
If you need to track this across different runs, then you could also use the named key value store with the stored ids rather then using request queue.mo0n7
07/24/2025, 8:43 PMcelnarapify
07/25/2025, 10:56 AM