Update DhenScraper.php
This commit is contained in:
@@ -23,9 +23,10 @@ class DhenScraper
|
||||
|
||||
$title = $crawler->filter('h1')->first()->text();
|
||||
|
||||
|
||||
|
||||
$image = $crawler->filter('article .article-visual img')->first()->attr('src');
|
||||
if($crawler->filter('article .article-visual img')->count() == 1)
|
||||
{
|
||||
$image = $crawler->filter('article .article-visual img')->first()->attr('src');
|
||||
}
|
||||
|
||||
$crawler->filter('article .article-entry p')->each(function ($node) {
|
||||
$this->content[] = preg_replace("/[a-zA-Z]/","",$node->text());
|
||||
@@ -44,7 +45,7 @@ class DhenScraper
|
||||
'source' => 'Dhen',
|
||||
'title' => $title,
|
||||
'og_title' => $crawler->filter('meta[property*="og:title"]')->first()->attr('content'),
|
||||
'image' => $image,
|
||||
'image' => $image ?? "images/noimg.jpg",
|
||||
'content' => $this->content,
|
||||
'url' => $url,
|
||||
'date' => Carbon::parse(str_replace("- ", "", $crawler->filter('.story-item--meta time')->first()->text()))->format("Y-m-d H:i:s"),
|
||||
|
Reference in New Issue
Block a user