ambitious-aqua•4y ago
How to pass UserData when executing crawler
When I do
await crawler.run(['https://crawlee.dev'], { userData: { depth: 0 } });
I got this error:
Uncaught ArgumentError ArgumentError: Did not expect property userData to exist, got [object Object] in object options
How can I set userData in option?
`4 Replies
await crawler.run([{url: 'https://crawlee.dev', userData: { depth: 0 } }]);userData is part of request, not part of crawler
fair-rose•4y ago
You passed the
userData as the second parameter of the run() method instead of within the request. Hence the ArgumentError.
Try this instead:
deep-jade•3y ago
Also, something that was not obvious to me was how to get the user data on the route.
you can do it like so