-
I have a list of web sites from which I am trying to scrape a given piece of info. For each site, once I have found that info, I want to stop and move on to the next (with several sites being scraped concurrently). I have tried the following approach (emptying the request queue when my goal is found) : request_queue = await RequestQueue.open()
crawler = PlaywrightCrawler(
request_provider=request_queue,
headless=True, # Show the browser window.
browser_type='firefox', # Use the Firefox browser.
)
await crawler.add_requests([root_url])
@crawler.router.default_handler
async def request_handler(context: PlaywrightCrawlingContext) -> None:
# ...
if found:
await request_queue.drop() But that's actually raising an error : ValueError: Request queue with id "default" does not exist. Any idea how I should proceed to have a finer control over the request queue ? Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Also, should |
Beta Was this translation helpful? Give feedback.
-
Let me get the requirements straight. There are several websites, and you want to crawl each of them until you find something specific. Do you use the same request handler for each page? I'm asking because it would make a lot of sense to keep the same crawler instance so that parallelism works well. |
Beta Was this translation helpful? Give feedback.
-
We will implement this, see #651 for more information. |
Beta Was this translation helpful? Give feedback.
We will implement this, see #651 for more information.