Ловим исключения в парсере Аперо

Чинит #1345
This commit is contained in:
Alexander Yakovlev 2023-02-28 17:29:22 +06:00
parent 4b03920b29
commit 2a6cdb1adf

View file

@ -24,7 +24,7 @@ use \App\Models\Language;
use \App\Models\Author;
use \App\Models\Tag;
use \App\Source;
use Log;
use Illuminate\Support\Facades\Log;
/**
* Парсер для Apero.ru
@ -49,12 +49,17 @@ class Apero extends Source {
$this->loadStr($text);
$this->parseIndex();
foreach ($this->urls as $url) {
$text = $this->get_text($url);
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
$this->loadStr($text);
$this->page($url);
try {
$text = $this->get_text($url);
$text = mb_convert_encoding($text, 'UTF-8', 'auto');
$this->loadStr($text);
$this->page($url);
} catch (\Exception $e) {
Log::error($e->getMessage());
continue;
}
}
}
}
public function parseIndex()
{