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

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