From 4b03920b299d43330e4f71cd8a8e6fc4d4b13bbd Mon Sep 17 00:00:00 2001 From: Aleksandr Yakovlev Date: Tue, 28 Feb 2023 17:20:12 +0600 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D0=BC=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D1=80=20=D0=9A=D0=B2=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Закрывает #1347 --- app/Console/Commands/Collect.php | 1 - app/Sources/Kvester.php | 71 -------------------------------- 2 files changed, 72 deletions(-) delete mode 100644 app/Sources/Kvester.php diff --git a/app/Console/Commands/Collect.php b/app/Console/Commands/Collect.php index 81d44b7..4246684 100644 --- a/app/Console/Commands/Collect.php +++ b/app/Console/Commands/Collect.php @@ -38,7 +38,6 @@ class Collect extends Command 'Itch', 'Instead', 'Steam', - 'Kvester', 'Urq', 'Instory', 'Ifiction', diff --git a/app/Sources/Kvester.php b/app/Sources/Kvester.php deleted file mode 100644 index 0725c3d..0000000 --- a/app/Sources/Kvester.php +++ /dev/null @@ -1,71 +0,0 @@ -. -*/ -namespace App\Sources; - -use \App\Models\Game; -use \App\Source; -use \App\Models\Language; -use \App\Models\Author; - -class Kvester extends Source { - public $title = "Квестер"; - public $keyword = 'kvester'; - protected $baseUrl = 'http://kvester.ru'; - public function parse() { - $text = $this->get_text($this->baseUrl."/catalog?sort=date"); - if (empty($text)) { - // Квестер опять упал - return; - } - $this->loadStr($text); - unset($text); - $this->dom->filter('.catalog-item')->each(function($gameBlock){ - $date = trim($gameBlock->filter('.cell-2 .date')->text(), "() \t\n\r\0\x0B"); - $date = \DateTime::createFromFormat("d.m.y", $date); - if ($date === false) return; - $game = new Game; - $game->release_date = $date; - $author = trim(strip_tags($gameBlock->filter('.cell-2 .author')->text())); - $game->title = trim($gameBlock->filter('.cell-2 h3 a')->text()); - $game->url = $this->baseUrl.trim($gameBlock->filter('.cell-2 h3 a')->attr('href')); - $game->description = ""; - - $this->loadStr($this->get_text($game->url)); - $game->description = $this->dom->filter('.description')->first()->text(); - $game = $this->findGame($game); - $game->save(); - - $language = Language::findByCode('ru'); - $game->languages()->sync([$language->id]); - - if (!empty($author)) { - $author_model = Author::findByName($author); - if (empty($author_model)) { - $author_model = new Author(); - $author_model->name = $author; - $author_model->save(); - } - $game->authors()->sync([$author_model->id]); - } - }); - } - public function checkPage($url) { - return (strpos($url, $this->baseUrl.'/game/') !== FALSE); - } -}