Support for Avas mv
This commit is contained in:
26
app/Services/AvasService.php
Normal file
26
app/Services/AvasService.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Services\Feeds\AvasFeed;
|
||||
use App\Services\Scrapers\AvasScraper;
|
||||
|
||||
class AvasService
|
||||
{
|
||||
/**
|
||||
* Scrap all the rss articles from Sun
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function scrape(): array
|
||||
{
|
||||
//Return only the rss that contains "news" keyboard in its url
|
||||
$articles = (new AvasFeed)->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 AvasScraper)->extract($article["link"]);
|
||||
}
|
||||
|
||||
return $articlesitems;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user