KomifloResolver: 作者情報と作品タグをタグとして保存

This commit is contained in:
shibafu 2019-04-29 14:49:34 +09:00
parent e4c942263a
commit 085afd3318

View File

@ -34,6 +34,20 @@ class KomifloResolver implements Resolver
($json['content']['parents'][0]['data']['title'] ?? '?');
$metadata->image = 'https://t.komiflo.com/564_mobile_large_3x/' . $json['content']['named_imgs']['cover']['filename'];
// 作者情報
if (!empty($json['content']['attributes']['artists']['children'])) {
foreach ($json['content']['attributes']['artists']['children'] as $artist) {
$metadata->tags[] = preg_replace('/\s/', '_', $artist['data']['name']);
}
}
// タグ
if (!empty($json['content']['attributes']['tags']['children'])) {
foreach ($json['content']['attributes']['tags']['children'] as $tag) {
$metadata->tags[] = preg_replace('/\s/', '_', $tag['data']['name']);
}
}
return $metadata;
} else {
throw new \RuntimeException("{$res->getStatusCode()}: $url");