From 0a994884a03af92ec5d31379b8def98e54d114f0 Mon Sep 17 00:00:00 2001 From: eai04191 Date: Thu, 22 Aug 2019 05:23:28 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E8=80=85=E5=90=8D=E3=82=92=E3=82=BF?= =?UTF-8?q?=E3=82=B0=E3=81=AB=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/MetadataResolver/IwaraResolver.php | 1 + tests/Unit/MetadataResolver/IwaraResolverTest.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/MetadataResolver/IwaraResolver.php b/app/MetadataResolver/IwaraResolver.php index 29938d6..736b3ca 100644 --- a/app/MetadataResolver/IwaraResolver.php +++ b/app/MetadataResolver/IwaraResolver.php @@ -32,6 +32,7 @@ class IwaraResolver implements Resolver $tags = $descriptionElement->filter('a[href^="/video-categories"], a[href^="/images"]')->extract('_text'); // 役に立たないタグを削除する $tags = array_values(array_diff($tags, ['Uncategorized', 'Other'])); + array_push($tags, $author); $metadata->title = $title; $metadata->description = '投稿者: ' . $author . PHP_EOL . $description; diff --git a/tests/Unit/MetadataResolver/IwaraResolverTest.php b/tests/Unit/MetadataResolver/IwaraResolverTest.php index ee19bb9..453fdd7 100644 --- a/tests/Unit/MetadataResolver/IwaraResolverTest.php +++ b/tests/Unit/MetadataResolver/IwaraResolverTest.php @@ -28,7 +28,7 @@ class IwaraResolverTest extends TestCase $metadata = $this->resolver->resolve($url); $this->assertEquals('Cakeface【鈴谷、プリンツ】', $metadata->title); $this->assertEquals('投稿者: kuro@vov' . PHP_EOL . 'Thank you for watching!いつもありがとうございます' . PHP_EOL . 'こっそり微修正…' . PHP_EOL . 'Model:鈴谷&プリンツ つみだんご様 罪袋:BCD様' . PHP_EOL . '(いずれも改変)クレジット漏れゴメンナサイ。。。' . PHP_EOL, $metadata->description); - $this->assertEquals(['KanColle'], $metadata->tags); + $this->assertEquals(['KanColle', 'kuro@vov'], $metadata->tags); $this->assertEquals('https://i.iwara.tv/sites/default/files/videos/thumbnails/238591/thumbnail-238591_0004.jpg', $metadata->image); if ($this->shouldUseMock()) { $this->assertSame($url, (string) $this->handler->getLastRequest()->getUri()); @@ -45,7 +45,7 @@ class IwaraResolverTest extends TestCase $metadata = $this->resolver->resolve($url); $this->assertEquals('むちむち天龍ちゃんで君色に染まる', $metadata->title); $this->assertEquals('投稿者: kochira' . PHP_EOL . 'Ray-cast test. Still trying to figure out how Ray-cast works so I\'m sorry if anything looks off.' . PHP_EOL . 'Unauthorized reproduction prohibited (無断転載は禁止です/未經授權禁止複製)' . PHP_EOL, $metadata->description); - $this->assertEquals(['KanColle'], $metadata->tags); + $this->assertEquals(['KanColle', 'kochira'], $metadata->tags); $this->assertEquals('https://img.youtube.com/vi/pvA5Db082yo/maxresdefault.jpg', $metadata->image); if ($this->shouldUseMock()) { $this->assertSame($url, (string) $this->handler->getLastRequest()->getUri()); @@ -62,7 +62,7 @@ class IwaraResolverTest extends TestCase $metadata = $this->resolver->resolve($url); $this->assertEquals('鏡音りん18歳', $metadata->title); $this->assertEquals('投稿者: Tonjiru Lion' . PHP_EOL . '今回はあんまエロくないです。' . PHP_EOL, $metadata->description); - $this->assertEquals(['Vocaloid'], $metadata->tags); + $this->assertEquals(['Vocaloid', 'Tonjiru Lion'], $metadata->tags); $this->assertEquals('https://i.iwara.tv/sites/default/files/photos/jing_yin_rin18sui_a.png', $metadata->image); if ($this->shouldUseMock()) { $this->assertSame($url, (string) $this->handler->getLastRequest()->getUri());