diff --git a/app/Services/Scrapers/AdhadhuScraper.php b/app/Services/Scrapers/AdhadhuScraper.php index a59d8ae..23d678a 100644 --- a/app/Services/Scrapers/AdhadhuScraper.php +++ b/app/Services/Scrapers/AdhadhuScraper.php @@ -35,8 +35,12 @@ class AdhadhuScraper // Extract image URL $this->image = $crawler->filter('img.img-fluid.hero-img')->first()->attr('src'); - // Extract author name - $this->author = $crawler->filter('.MuiAvatar-circle img')->first()->attr('alt'); + $authorNode = $crawler->filter('.MuiAvatar-circle img'); + if ($authorNode->count() > 0) { + $this->author = $authorNode->first()->attr('alt'); + } else { + $this->author = 'unknown'; // Set to 'Unknown' if author element is not found + } // Extract content $crawler->filter('.body > p')->each(function ($node) {