max_results = 5 # example crawler = PlaywrightCrawler( headless=False, request_handler=router, ) await crawler.run([start_url])
@router.default_handler async def default_handler(context: PlaywrightCrawlingContext) -> None: max_results = ???
request = Request.from_url( url=start_url, user_data={ "max_results": max_results, } ) print(start_urls) crawler = PlaywrightCrawler( headless=False, request_handler=router, ) await crawler.run([request])
@router.default_handler async def default_handler(context: PlaywrightCrawlingContext) -> None: max_results = context.request.user_data.get('max_results') print(f"Max results: {max_results}")