Add adhadhu support

This commit is contained in:
Mohamed jinas
2024-01-07 16:58:18 +05:00
parent 1cc86fbbde
commit 46ead16ef8
11 changed files with 497 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Services;
use App\Services\Feeds\AdhadhuFeed;
use App\Services\Scrapers\AdhadhuScraper;
class AdhadhuService extends Client
{
/**
* Scrap all the rss articles from Adhadhu
*
* @return array
*/
public function scrape(): array
{
$articles = (new AdhadhuFeed)->get();
$articleItems = [];
foreach ($articles as $article) {
$scrapedData = (new AdhadhuScraper)->extract($article["link"], $article["date"]);
if ($scrapedData !== null) {
$articleItems[] = $scrapedData;
}
}
return $articleItems;
}
}