Files
karudhaas/app/Services/MihaaruService.php
2020-08-10 03:21:56 +05:00

32 lines
682 B
PHP

<?php
namespace App\Services;
use App\Services\Scrapers\MihaaruScraper;
class MihaaruService extends Client
{
/**
* Scrap all the rss articles from mihaaru
*
* @return array
*/
public function scrape() : array
{
$articles = $this->get("https://mihaaru.com/rss")["channel"]["item"];
$articlesitems = [];
$scraper = new MihaaruScraper();
foreach ($articles as $article) {
$link = $article['link'];
$date = $article['pubDate'];
$guid = $article['guid'];
$articlesitems[] = $scraper->extract($link, $date, $guid);
}
return $articlesitems;
}
}