OneOnline Support

This commit is contained in:
2020-09-27 23:44:54 +05:00
parent 94fda48b90
commit 179bedead9
5 changed files with 216 additions and 12 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Services;
use App\Services\Feeds\OneOnlineFeed;
use App\Services\Scrapers\OneOnlineScraper;
class OneOnlineService
{
/**
* 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 OneOnlineFeed)->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 OneOnlineScraper)->extract($article["link"]);
}
return $articlesitems;
}
}