Files
karudhaas/app/Services/ThiladhunService.php
Mohamed jinas 38d14a812c WIP
2024-01-07 21:45:37 +05:00

31 lines
755 B
PHP

<?php
namespace App\Services;
use App\Services\Feeds\ThiladhunFeed;
use App\Services\Scrapers\ThiladhunScraper;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
class ThiladhunService extends Client
{
/**
* Scrap all the rss articles from Thiladhun
*
* @return array
*/
public function scrape(): array
{
$articles = (new ThiladhunFeed)->get();
$articlesitems = [];
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
foreach ($articles as $article) {
//Remove query strings
$articlesitems[] = (new ThiladhunScraper)->extract($article["link"]);
}
return $articlesitems;
}
}