Files
karudhaas/app/Services/RaajjeMvService.php
2020-10-15 06:47:05 +05:00

28 lines
718 B
PHP

<?php
namespace App\Services;
use App\Services\Feeds\RaajjeMvFeed;
use App\Services\Scrapers\RaajjeMvScraper;
class RaajjeMvService
{
/**
* Scrap all the rss articles from Sun
*
* @return array
*/
public function scrape(): array
{
//Return only the rss that contains "news" keyboard in its url
$articles = (new RaajjeMvFeed)->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 RaajjeMvScraper)->extract($article["link"], $article["date"]);
}
return $articlesitems;
}
}