WIP
This commit is contained in:
@@ -35,8 +35,12 @@ class AdhadhuScraper
|
|||||||
// Extract image URL
|
// Extract image URL
|
||||||
$this->image = $crawler->filter('img.img-fluid.hero-img')->first()->attr('src');
|
$this->image = $crawler->filter('img.img-fluid.hero-img')->first()->attr('src');
|
||||||
|
|
||||||
// Extract author name
|
$authorNode = $crawler->filter('.MuiAvatar-circle img');
|
||||||
$this->author = $crawler->filter('.MuiAvatar-circle img')->first()->attr('alt');
|
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
|
// Extract content
|
||||||
$crawler->filter('.body > p')->each(function ($node) {
|
$crawler->filter('.body > p')->each(function ($node) {
|
||||||
|
|||||||
Reference in New Issue
Block a user