WIP
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user