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

41 lines
904 B
PHP

<?php
namespace App\Services\Feeds;
use Goutte\Client;
class RaajjeMvFeed implements Feed
{
protected $client;
public function __construct()
{
$this->client = new Client();
}
/**
* Get all the latest news
*
* @return array
*/
public function get(): array
{
$crawler = $this->client->request('GET', "https://raajje.mv/");
$feeds = [];
$articles = $crawler->filter('div[v-if*="homepage.emme_fas"] article-grid')->first()->attr(':collection');
$raw_response = json_decode(html_entity_decode($articles), true);
foreach($raw_response as $response)
{
$feeds[] = [
"title" => $response["heading"],
"link" => "https://raajje.mv/".$response["id"],
"date" => $response["approved_date"]
];
}
return $feeds;
}
}