From c79c4387d9b314664ade05ba9cb598179738bc18 Mon Sep 17 00:00:00 2001 From: Pablo Ogando Ferreira Date: Sat, 23 Mar 2024 18:48:12 +0100 Subject: [PATCH] fix(import): fix move to playlist --- Command/ImportVideosOnPlaylistCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Command/ImportVideosOnPlaylistCommand.php b/Command/ImportVideosOnPlaylistCommand.php index 1533f93..9dde20b 100644 --- a/Command/ImportVideosOnPlaylistCommand.php +++ b/Command/ImportVideosOnPlaylistCommand.php @@ -63,7 +63,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $service = $this->googleAccountService->googleServiceFromAccount($youtubeAccount); $this->channelId = $this->channelId($channel, $service); - $nextPageToken = null; $count = 0; $queryParams = [ 'maxResults' => 50, @@ -82,8 +81,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $queryParams['playlistId'] = $playlist->getProperty('youtube_import_id'); + $service = $this->googleAccountService->googleServiceFromAccount($youtubeAccount); $response = $service->playlistItems->listPlaylistItems('snippet', $queryParams); - $nextPageToken = $response->getNextPageToken(); + $nextPageToken = null; if (0 === count($response->getItems())) { continue; @@ -98,6 +98,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $queryParams['pageToken'] = $nextPageToken; } + $service = $this->googleAccountService->googleServiceFromAccount($youtubeAccount); + $response = $service->playlistItems->listPlaylistItems('snippet', $queryParams); + $nextPageToken = $response->getNextPageToken(); + foreach ($response->getItems() as $item) { $videoId = $item->getSnippet()->getResourceId()->getVideoId();