Commands and scraper
This commit is contained in:
31
app/Services/MihaaruService.php
Normal file
31
app/Services/MihaaruService.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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 = [];
|
||||
$emihaaru = new MihaaruScraper();
|
||||
|
||||
foreach ($articles as $article) {
|
||||
$link = $article['link'];
|
||||
$date = $article['pubDate'];
|
||||
$guid = $article['guid'];
|
||||
$articlesitems[] = $emihaaru->extract($link, $date, $guid);
|
||||
}
|
||||
|
||||
return $articlesitems;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user