Files
karudhaas/app/Services/VoiceService.php
2020-08-18 00:47:08 +05:00

26 lines
627 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("https://voice.mv/".$article[1]);
}
return $articlesitems;
}
}