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