Avas fix
This commit is contained in:
@@ -26,9 +26,8 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('scrape:mihaaru')->everyFiveMinutes()
|
||||
->pingOnSuccess(env('APP_URL') . "/api/ping/mihaaru")
|
||||
->runInBackground();
|
||||
|
||||
->runInBackground()
|
||||
->pingOnSuccess(env('APP_URL') . "/api/ping/mihaaru");
|
||||
|
||||
$schedule->command('scrape:sun')->everyFiveMinutes()
|
||||
->runInBackground()
|
||||
|
||||
@@ -18,7 +18,10 @@ class AvasService
|
||||
$articlesitems = [];
|
||||
//Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
|
||||
foreach ($articles as $article) {
|
||||
$articlesitems[] = (new AvasScraper)->extract($article["link"], $article["date"]);
|
||||
$scraped_article = (new AvasScraper)->extract($article["link"], $article["date"]);
|
||||
if (!is_null($scraped_article)) {
|
||||
$articlesitems[] = $scraped_article;
|
||||
}
|
||||
}
|
||||
|
||||
return $articlesitems;
|
||||
|
||||
@@ -30,6 +30,11 @@ class AvasScraper
|
||||
$this->image = $crawler->filter('figure img')->first()->attr('src');
|
||||
}
|
||||
|
||||
if($crawler->filter('.post_content p')->count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$crawler->filter('.post_content p')->each(function ($node) {
|
||||
$this->content[] = preg_replace("/[a-zA-Z]/","",$node->text());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user