Feshun Support
This commit is contained in:
26
app/Services/FeshunService.php
Normal file
26
app/Services/FeshunService.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Services\Scrapers\FeshunScraper;
|
||||
|
||||
class FeshunService extends Client
|
||||
{
|
||||
/**
|
||||
* Scrap all the rss articles from Thiladhun
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function scrape(): array
|
||||
{
|
||||
$articles = $this->get("https://feshun.mv/feed")["channel"]["item"];
|
||||
|
||||
$articlesitems = [];
|
||||
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
|
||||
foreach ($articles as $article) {
|
||||
$articlesitems[] = (new FeshunScraper)->extract($article['link'], $article['pubDate']);
|
||||
}
|
||||
|
||||
return $articlesitems;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user