Add Minoos support

This commit is contained in:
Mohamed jinas
2024-01-12 04:34:28 +05:00
parent fbaa43748f
commit 46e2e849bb
5 changed files with 194 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Services;
use App\Services\Feeds\MinoosFeed;
use App\Services\Feeds\OneOnlineFeed;
use App\Services\Scrapers\MinoosScraper;
use App\Services\Scrapers\OneOnlineScraper;
class MinoosService
{
/**
*
* @return array
*/
public function scrape(): array
{
//Return only the rss that contains "news" keyboard in its url
$articles = (new MinoosFeed)->get();
$articlesitems = [];
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
foreach ($articles as $article) {
$scraped_article = (new MinoosScraper)->extract($article["link"], $article["date"], $article["highlights"]);
if (!is_null($scraped_article)) {
$articlesitems[] = $scraped_article;
}
}
return $articlesitems;
}
}