29 lines
615 B
PHP
29 lines
615 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Services\Feeds\VoiceFeed;
|
|
use App\Services\Scrapers\VoiceScraper;
|
|
|
|
class VoiceService
|
|
{
|
|
/**
|
|
* Scrap all the rss articles from Sun
|
|
*
|
|
* @return array
|
|
*/
|
|
public function scrape(): array
|
|
{
|
|
$articles = (new VoiceFeed)->get();
|
|
|
|
$articlesitems = [];
|
|
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
|
|
foreach ($articles as $article) {
|
|
|
|
$articlesitems[] = (new VoiceScraper)->extract($article["link"]);
|
|
}
|
|
|
|
return $articlesitems;
|
|
}
|
|
}
|