Dhiyares intergration

This commit is contained in:
2021-02-05 04:18:29 +05:00
parent 8ea594723f
commit e2bfb8de57
5 changed files with 211 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Services;
use App\Services\Feeds\DhiyaresFeed;
use App\Services\Scrapers\DhiyaresScraper;
class DhiyaresService extends Client
{
/**
* Scrap all the rss articles from Thiladhun
*
* @return array
*/
public function scrape(): array
{
//Return only the rss that contains "news" keyboard in its url
$articles = (new DhiyaresFeed)->get();
$articlesitems = [];
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
foreach ($articles as $article) {
$articlesitems[] = (new DhiyaresScraper)->extract($article["link"], $article["date"]);
}
return $articlesitems;
}
}