Skip to content

Commit

Permalink
fix: check if there are snippet on videoListResponse from Youtube
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Mar 22, 2024
1 parent e0c0bde commit 83ad160
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Command/ImportVideosFromYouTubeChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ private function ensureMultimediaObjectExists(Series $series, string $videoId):
private function autocompleteMultimediaObjectMetadata(MultimediaObject $multimediaObject, VideoListResponse $videoInfo): MultimediaObject
{
$youtubeInfo = $videoInfo->getItems()[0];
if (!$youtubeInfo->snippet) {
throw new \Exception('Snippet not found for MultimediaObject '. $multimediaObject->getId());
}

$text = $this->i18nService->generateI18nText($youtubeInfo->snippet->title);
$multimediaObject->setI18nTitle($text);
Expand Down

0 comments on commit 83ad160

Please sign in to comment.