Update DhenScraper.php

This commit is contained in:
2020-10-02 16:22:34 +05:00
parent c0b09b47b6
commit 83132bc45c

View File

@@ -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"),