Add Minoos support
This commit is contained in:
38
app/Services/Feeds/MinoosFeed.php
Normal file
38
app/Services/Feeds/MinoosFeed.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace App\Services\Feeds;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class MinoosFeed implements Feed
|
||||
{
|
||||
protected $client;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->client = new Client();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the latest news
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get() : array
|
||||
{
|
||||
$response = $this->client->request('GET', "https://fili.minoos.mv/api/category/news/posts");
|
||||
$data = json_decode($response->getBody(), true);
|
||||
|
||||
$feeds = [];
|
||||
foreach ($data['data'] as $item) {
|
||||
$feeds[] = [
|
||||
"title" => $item['heading'],
|
||||
"link" => "https://minoos.mv/" . $item['id'],
|
||||
"date" => $item['published_at'],
|
||||
"highlights" => $item['highlights'],
|
||||
];
|
||||
}
|
||||
|
||||
return $feeds;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user