Update AvasScraper.php

This commit is contained in:
2020-09-24 13:37:36 +05:00
parent b8641509a5
commit 4c72042aeb

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace App\Services\Scrapers; namespace App\Services\Scrapers;
use Goutte\Client; use Goutte\Client;
@@ -26,7 +27,7 @@ class AvasScraper
$image = $crawler->filter('figure img')->first()->attr('src'); $image = ($crawler->filter('figure img')->first()->attr('src')) ? $crawler->filter('figure img')->first()->attr('src') : "/images/noimg.jpg";
$crawler->filter('.post_content p')->each(function ($node) { $crawler->filter('.post_content p')->each(function ($node) {
$this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text()); $this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text());
@@ -35,8 +36,7 @@ class AvasScraper
$crawler->filter('div[class*="border-t border-grey-light border-dotted mt-7 py-3"] a')->each(function ($node) { $crawler->filter('div[class*="border-t border-grey-light border-dotted mt-7 py-3"] a')->each(function ($node) {
//Removing the show more tags button //Removing the show more tags button
if($node->text() == "+") if ($node->text() == "+") {
{
return; return;
} }
$this->topics[] = [ $this->topics[] = [
@@ -47,8 +47,7 @@ class AvasScraper
if($crawler->filter('div[class*="font-waheed text-grey ml-3 pl-3 text-lg border-l border-grey border-dotted"] a')->count() == 1) if ($crawler->filter('div[class*="font-waheed text-grey ml-3 pl-3 text-lg border-l border-grey border-dotted"] a')->count() == 1) {
{
$this->author = $crawler->filter('div[class*="font-waheed text-grey ml-3 pl-3 text-lg border-l border-grey border-dotted"] a')->first()->text(); $this->author = $crawler->filter('div[class*="font-waheed text-grey ml-3 pl-3 text-lg border-l border-grey border-dotted"] a')->first()->text();
} }