naimish5329
09/14/2024, 11:14 AM// Import the JavaScript SDK into your project
import { Actor } from 'apify';
await Actor.init();
// ...
const queue = await Actor.openRequestQueue();
// Enqueue requests
await queue.addRequests([{ url: 'http://example.com/aaa' }]);
await queue.addRequests(['http://example.com/foo', 'http://example.com/bar'], {
forefront: true,
});
// Get the next request from queue
const request1 = await queue.fetchNextRequest();
const request2 = await queue.fetchNextRequest();
// Get a specific request
const specificRequest = await queue.getRequest('shi6Nh3bfs3');
// Reclaim a failed request back to the queue
// and process it again
await queue.reclaimRequest(request2);
// Remove a queue
await queue.drop();
// ...
await Actor.exit();
I am getting this error.
https://cdn.discordapp.com/attachments/1284472419800715294/1284472420153032788/image.png?ex=66e6c1a9&is=66e57029&hm=8965ee6e0d97be4dc73794e38beb41bf5194210164632bb00590582fcb1feec8&Hall
09/14/2024, 11:14 AMolegv._apify
09/17/2024, 8:54 AM// instead of:
await queue.addRequests(['http://example.com/foo', 'http://example.com/bar'], {
forefront: true,
});
// try to add Request object (https://crawlee.dev/api/core/class/Request):
await queue.addRequests([
{
url: 'http://example.com/foo',
},
{
url: 'http://example.com/bar'
}
], {
forefront: true,
});