Raajje mv intergration

This commit is contained in:
2020-10-15 06:47:05 +05:00
parent fff50a36ac
commit 79dca057a9
5 changed files with 201 additions and 0 deletions

View File

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