Skip to content

Commit

Permalink
fix(import): fix move to playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Mar 23, 2024
1 parent 5d17542 commit c79c438
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Command/ImportVideosOnPlaylistCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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();

Expand Down

0 comments on commit c79c438

Please sign in to comment.