This commit is contained in:
Mohamed jinas
2024-01-13 03:35:37 +05:00
parent be67994a1f
commit 2c4f670811

View File

@@ -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) {