Add Minoos support
This commit is contained in:
31
app/Services/MinoosService.php
Normal file
31
app/Services/MinoosService.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user