From c0e7069e67ce2781db7da4326472a4bc867382f6 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Sun, 19 Apr 2020 14:10:49 +0700 Subject: [PATCH] set source_id on instory games --- app/Sources/Instory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Sources/Instory.php b/app/Sources/Instory.php index 1c6da7c..216d280 100644 --- a/app/Sources/Instory.php +++ b/app/Sources/Instory.php @@ -42,7 +42,11 @@ class Instory extends Source { $this->dom->filter('.container .at-card')->each(functioN($gameBlock) { $game = new Game; $game->title = trim($gameBlock->filter('h5')->text()); - $game->url = 'https://instory.su'.trim($gameBlock->filter('h5 a')->attr('href')); + $url = trim($gameBlock->filter('h5 a')->attr('href')); + $game->url = 'https://instory.su'.$url; + if (strpos($url, '/story/') !== false) { + $game->source_id = (int) str_replace('/story/', '', $url); + } $game->description = trim($gameBlock->filter('.post-card__excerpt')->html()); $game->release_date = $this->downloader->convertDate($gameBlock->filter('.at-author__extend span')->text()); $game = $this->findGame($game);