39 lines
810 B
PHP
39 lines
810 B
PHP
<?php
|
|
namespace App\Services\Feeds;
|
|
|
|
use Goutte\Client;
|
|
|
|
class DhiyaresFeed 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://dhiyares.com");
|
|
|
|
$feeds = [];
|
|
$crawler->filter('.recent-list')->each(function ($node) use (&$feeds) {
|
|
|
|
|
|
$feeds[] = [
|
|
"title" => $node->filter('h3')->text(),
|
|
"link" => $node->filter('a')->attr('href'),
|
|
"date" => $node->filter('time-comment')->first()->attr('datetime')
|
|
];
|
|
|
|
});
|
|
|
|
return $feeds;
|
|
|
|
}
|
|
} |