OneOnline Support
This commit is contained in:
37
app/Services/Feeds/OneOnlineFeed.php
Normal file
37
app/Services/Feeds/OneOnlineFeed.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace App\Services\Feeds;
|
||||
|
||||
use Goutte\Client;
|
||||
|
||||
class OneOnlineFeed
|
||||
{
|
||||
protected $client;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->client = new Client();
|
||||
}
|
||||
/**
|
||||
* Return the latest articles from avas
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get() : array
|
||||
{
|
||||
|
||||
$crawler = $this->client->request('GET', "https://oneonline.mv/");
|
||||
|
||||
$feeds = [];
|
||||
|
||||
$crawler->filter('.latest-listing a')->each(function($node) use (&$feeds){
|
||||
$feeds[] = [
|
||||
"title" => $node->text(),
|
||||
"link" => $node->attr('href')
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
return $feeds;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user