Add adhadhu support
This commit is contained in:
29
app/Services/AdhadhuService.php
Normal file
29
app/Services/AdhadhuService.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user