33 lines
720 B
PHP
33 lines
720 B
PHP
<?php
|
|
namespace App\Services\Feeds;
|
|
|
|
use Goutte\Client;
|
|
|
|
class VoiceFeed 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://voice.mv/");
|
|
|
|
return $crawler->filter('div#latest-news > div > a')->each(function ($node) {
|
|
return [
|
|
"title" => $node->filter('.dv-bold')->text(),
|
|
"link" => 'https://voice.mv' . $node->attr('href'),
|
|
"date" => $node->filter('.en-font')->text(),
|
|
];
|
|
});
|
|
}
|
|
}
|