役に立たないタグを含めない

This commit is contained in:
eai04191 2019-08-22 05:17:23 +09:00
parent 5069f20b50
commit 9926cc3357
2 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,8 @@ class IwaraResolver implements Resolver
$author = $descriptionElement->filter('.username')->text();
$description = $descriptionElement->children('div')->eq(1)->text();
$tags = $descriptionElement->filter('a[href^="/video-categories"], a[href^="/images"]')->extract('_text');
// 役に立たないタグを削除する
$tags = array_values(array_diff($tags, ['Uncategorized', 'Other']));
$metadata->title = $title;
$metadata->description = '投稿者: ' . $author . PHP_EOL . $description;

View File

@ -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(['Uncategorized', 'KanColle'], $metadata->tags);
$this->assertEquals(['KanColle'], $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(['Uncategorized', 'KanColle'], $metadata->tags);
$this->assertEquals(['KanColle'], $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());