Ignore gallery fix

This commit is contained in:
2020-10-02 16:12:53 +05:00
parent 5f1a90a4c7
commit c0b09b47b6
2 changed files with 7 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace App\Services; namespace App\Services;
use App\Services\Feeds\OneOnlineFeed; use App\Services\Feeds\OneOnlineFeed;
@@ -18,9 +19,12 @@ class OneOnlineService
$articlesitems = []; $articlesitems = [];
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper. //Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
foreach ($articles as $article) { foreach ($articles as $article) {
$articlesitems[] = (new OneOnlineScraper)->extract($article["link"]); $scraped_article = (new OneOnlineScraper)->extract($article["link"]);
if (!is_null($scraped_article)) {
$articlesitems[] = $scraped_article;
}
} }
return $articlesitems; return $articlesitems;
} }
} }

View File

@@ -26,7 +26,7 @@ class OneOnlineScraper
if($crawler->filter('.gallery-cover')->count() > 0) if($crawler->filter('.gallery-cover')->count() > 0)
{ {
return 0; return;
} }
$crawler->filter('h1')->each(function ($node) { $crawler->filter('h1')->each(function ($node) {