dhen fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Scrapers;
|
namespace App\Services\Scrapers;
|
||||||
|
|
||||||
use Goutte\Client;
|
use Goutte\Client;
|
||||||
@@ -23,19 +24,24 @@ class DhenScraper
|
|||||||
|
|
||||||
$title = $crawler->filter('h1')->first()->text();
|
$title = $crawler->filter('h1')->first()->text();
|
||||||
|
|
||||||
if($crawler->filter('article .article-visual img')->count() == 1)
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($crawler->filter('article .article-entry p')->count() > 0) {
|
||||||
$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());
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$crawler->filter('.im_message_body .im_message_text')->each(function ($node) {
|
||||||
|
$this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($crawler->filter(".story-item--meta a")->count() == 1)
|
|
||||||
{
|
if ($crawler->filter(".story-item--meta a")->count() == 1) {
|
||||||
$this->author = $crawler->filter('.story-item--meta a')->first()->text();
|
$this->author = $crawler->filter('.story-item--meta a')->first()->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user