Closed adzay closed 2 years ago
This will be part of the upcoming 1.0 release. A new method Roach::collectSpider(...)
will get added that behaves the exact same way as Roach::startSpider(...)
except that it will return all scraped items after the run.
// $scrapedItems is an array<int, ItemInterface>
$scrapedItems = Roach::collectSpider(MySpider::class);
This is possible in the 1.0 release. Please check out this section of the docs for more information.
I am running unit tests and i want to get all items scraped into an array. I plan to show the results in a Vue componenent so I need to return the results from a Laravel controller.
I am getting phpUnit logs that the terms have been successfully crawled. However the below results produces a null result.
Please help I have read your docs but it talks about handling data within the generator (itemsPipeline), nothing about exporting results.
Thanks