0

I'm trying to get videos from my channel using search function. Response include only nextPageToken, but no prevPageToken. prevPageToken is null always, even if I'm listing other pages using nextPageToken. I use an access_token param from Google Oauth.

My request:

  $searchResponse = $youtube->search->listSearch('snippet', array(
    'forMine' => 'true',
    'order' => 'date',
    'pageToken' => $pageToken,
    'type'=>'video',
    'maxResults' => '10',
    'q' => $searchQuery,
  ));

Result:

Google_Service_YouTube_SearchListResponse Object
(
    [collection_key:protected] => items
    [etag] => "XXX"
    [eventId] => 
    [itemsType:protected] => Google_Service_YouTube_SearchResult
    [itemsDataType:protected] => array
    [kind] => youtube#searchListResponse
    [nextPageToken] => Cib3-ZrgSf____9uWHdEYVNIVnlOVQD_Af_-blh3RGFTSFZ5TlUAARAPIbmtEhE6-iWlOQAAAAC2H2UGSAFQAFoLCdIYcGeU2-YsEAJgyOjNygE=
    [pageInfoType:protected] => Google_Service_YouTube_PageInfo
    [pageInfoDataType:protected] => 
    [prevPageToken] => 
    [regionCode] => 
    [tokenPaginationType:protected] => Google_Service_YouTube_TokenPagination
    [tokenPaginationDataType:protected] => 
    [visitorId] => 
    [internal_gapi_mappings:protected] => Array
        (
        )

    [modelData:protected] => Array
        (
        )

    [processed:protected] => Array
        (
        )

    [pageInfo] => Google_Service_YouTube_PageInfo Object
        (
            [resultsPerPage] => 5
            [totalResults] => 55
            [internal_gapi_mappings:protected] => Array
                (
                )

            [modelData:protected] => Array
                (
                )

            [processed:protected] => Array
                (
                )

        )

Thank you for your ideas! Petr

UPDATE This problem is only if is set param forMine. But I need show only my videos...

  • Based from this [documentation](https://developers.google.com/resources/api-libraries/documentation/youtube/v3/java/latest/com/google/api/services/youtube/model/SearchListResponse.html#getPrevPageToken()), the intended response of `getPrevPageToken` is either it will return `value` or `null` for none. You may also refer with this [thread](https://stackoverflow.com/questions/33124788/youtube-searchlist-getting-pageinfo-and-nextpagetoken-null) which stated that you might get a `null` if you didn't mention the pagetoken in the response. – abielita Sep 11 '17 at 16:03
  • Thank you, I'm added 'fields' do my request: `'fields' => 'items/snippet,nextPageToken,pageInfo,prevPageToken,tokenPagination' ` but response is still the same, no `prevPageToken`. – Petr Beneš Sep 12 '17 at 08:36

0 Answers0