textの引数を指定して例外を回避する

This commit is contained in:
eai04191 2019-08-29 00:00:03 +09:00
parent 8ef9a1f8f4
commit a088444626

View File

@ -28,10 +28,7 @@ class IwaraResolver implements Resolver
$infoElements = $crawler->filter('#video-player + div, .field-name-field-video-url + div, .field-name-field-images + div'); $infoElements = $crawler->filter('#video-player + div, .field-name-field-video-url + div, .field-name-field-images + div');
$title = $infoElements->filter('h1.title')->text(); $title = $infoElements->filter('h1.title')->text();
$author = $infoElements->filter('.username')->text(); $author = $infoElements->filter('.username')->text();
$description = ''; $description = $infoElements->filter('.field-type-text-with-summary')->text('');
if ($infoElements->filter('.field-type-text-with-summary')->count()) {
$description = $infoElements->filter('.field-type-text-with-summary')->text();
}
$tags = $infoElements->filter('a[href^="/video-categories"], a[href^="/images"]')->extract('_text'); $tags = $infoElements->filter('a[href^="/video-categories"], a[href^="/images"]')->extract('_text');
// 役に立たないタグを削除する // 役に立たないタグを削除する
$tags = array_values(array_diff($tags, ['Uncategorized', 'Other'])); $tags = array_values(array_diff($tags, ['Uncategorized', 'Other']));