Files
karudhaas/app/Services/FeshunService.php
2020-09-28 00:36:10 +05:00

27 lines
658 B
PHP

<?php
namespace App\Services;
use App\Services\Scrapers\FeshunScraper;
class FeshunService extends Client
{
/**
* Scrap all the rss articles from Thiladhun
*
* @return array
*/
public function scrape(): array
{
$articles = $this->get("https://feshun.mv/feed")["channel"]["item"];
$articlesitems = [];
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
foreach ($articles as $article) {
$articlesitems[] = (new FeshunScraper)->extract($article['link'], $article['pubDate']);
}
return $articlesitems;
}
}