Can I pass custom parameters in the addRequest so that I can use in the router-hander callback function? #1688
Answered
by
metalwarrior665
ParadiseWitch
asked this question in
Q&A
-
Can I pass custom parameters in the addRequest so that I can use in the router-hander callback function? maybe like this: const router = createPlaywrightRouter()
router.addHandler('detail', async ({ request, page, log, crawler }, param) => {
// get param...
log.info(param) // 'my custom param'
})
const crawler = new PlaywrightCrawler({ requestHandler: router })
await crawler.addRequests([{
url: `http://www.xxx.com`,
label: 'detail',
param: 'my custom param'
}])
await crawler.run() |
Beta Was this translation helpful? Give feedback.
Answered by
metalwarrior665
Nov 23, 2022
Replies: 2 comments 3 replies
-
Request.userData https://crawlee.dev/api/core/class/Request#userData |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
metalwarrior665
-
@metalwarrior665 Can we pass function in userData ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Request.userData https://crawlee.dev/api/core/class/Request#userData