Version: 3.17createPlaywrightRouter CallablecreatePlaywrightRouter<Context, Routes>(routes): RouterHandler<Context, Routes>createPlaywrightRouter<Context, UserData>(routes): RouterHandler<Context, Record<string, UserData>>Creates new Router instance that works based on request labels. This instance can then serve as a requestHandler of your PlaywrightCrawler. Defaults to the PlaywrightCrawlingContext. Serves as a shortcut for using Router.create<PlaywrightCrawlingContext>().import { PlaywrightCrawler, createPlaywrightRouter } from 'crawlee';const router = createPlaywrightRouter();router.addHandler('label-a', async (ctx) => { ctx.log.info('...');});router.addDefaultHandler(async (ctx) => { ctx.log.info('...');});const crawler = new PlaywrightCrawler({ requestHandler: router,});await crawler.run();Parametersoptionalroutes: RouterRoutes<Context, Routes>Returns RouterHandler<Context, Routes>
Creates new Router instance that works based on request labels. This instance can then serve as a
requestHandlerof your PlaywrightCrawler. Defaults to the PlaywrightCrawlingContext.