You are here

private function FeedsYouTubeFetcher::requestNextPage in Feeds: YouTube Parser 8

Perform API request to YouTube API and retrieve search result.

Parameters

string $url: The URL to request.

string $page_token: The page token for the request.

Google_Client $client: A Google client to use.

Google_Service_YouTube $youtube: A Google YouTube service to use.

Return value

array|null

1 call to FeedsYouTubeFetcher::requestNextPage()
FeedsYouTubeFetcher::get in src/Feeds/Fetcher/FeedsYouTubeFetcher.php
Make the API queries to get the data the parser needs.

File

src/Feeds/Fetcher/FeedsYouTubeFetcher.php, line 292

Class

FeedsYouTubeFetcher
Constructs FeedsYouTubeFetcher object.

Namespace

Drupal\feeds_youtube\Feeds\Fetcher

Code

private function requestNextPage($url, $page_token = '', $client, $youtube) {
  $result = [];
  $response = $this
    ->requestUrl($url, $page_token);
  if (!empty($response['items'])) {
    $result = $this
      ->parseVideoItems($response);
  }
  else {
    \Drupal::messenger()
      ->addStatus($this
      ->t('No videos found.'));
  }
  return [
    'result' => $result,
    'next_page_token' => isset($search_response['nextPageToken']) ? $search_response['nextPageToken'] : '',
  ];
}