37 lines
750 B
PHP
37 lines
750 B
PHP
<?php
|
|
namespace App\Services\Feeds;
|
|
|
|
use Goutte\Client;
|
|
|
|
class ThePressFeed 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://thepress.mv/");
|
|
|
|
$feeds = [];
|
|
|
|
$crawler->filter('div[class*="col-lg-3 col-lg-cm-5 col-md-6 col-6"] a')->each(function($node) use (&$feeds){
|
|
$feeds[] = [
|
|
"title" => $node->text(),
|
|
"link" => $node->attr('href')
|
|
];
|
|
});
|
|
|
|
return $feeds;
|
|
|
|
|
|
}
|
|
} |