Raajje mv intergration

This commit is contained in:
2020-10-15 06:47:05 +05:00
parent fff50a36ac
commit 79dca057a9
5 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?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;
}
}