Feshun Support

This commit is contained in:
2020-09-28 00:36:10 +05:00
parent 179bedead9
commit 1994fedf11
4 changed files with 176 additions and 0 deletions

View 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;
}
}