Apify Discord Mirror

Updated last year

Is it possible to run a crawl within a crawl?

At a glance

The community member has set up a crawler (x) that collects links from a page, and they want to run another crawler (y) within the x crawl to collect more data and return it with the rest of the x crawl data. They are unsure if this is possible. The comments suggest that instead of running a crawl within a crawl, the community member should set up separate request queues for each crawler, and in the first crawler, they can add new requests to the second request queue and pass partial information using the request's user data. This way, the second crawler can access the data from the first crawler and process it further.

I have a crawler I have setup (x) that collects links from a page. I want to run another crawler(y) within x crawl to collect more data and return it with the rest of x crawl data. Is it possible to do this?

(I know you can add requests to the queue from a crawl but I want to keep the data together)

example data structure:
Plain Text
const data = [{
    // from "x" crawl
    title: 'a page',
    links: [
        {
            // from "y" crawl
            title: 'a page',
            link: 'link'
        }
    ]
}]
A
J
P
5 comments
just advanced to level 1! Thanks for your contributions! πŸŽ‰
Is it possible to run a crawl within a crawl?
Hi ,
For using two crawlers I advice you to set separate RequestQueue for each of them.You may set RequestQueue1 to Crawler1 and RequestQueue2 to Crawler2.Then in Crawler1, you may add new request to the RequestQueue2 and pass partional information from processing Request in Crawler1 by using Request.userData.So in Crawler2 you'ill have access to the Request userData from Crawler1 and you may modify it and save to the Dataset.
I just noticed you want to run crawler inside another crawler, and I don't see any point in it, you should be able to enqueue new Request and pass current value as Request.userData and process if afterwards and save to the Dataset.
Thanks! Will do that
Add a reply
Sign up and join the conversation on Discord