Search code examples
androidyoutubeyoutube-apiandroid-youtube-apiyoutube-data-api

How to set chart parameter in YouTube Data API v3( JAVA / Android)


Hi here is my code to get videos list.

YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet, contentDetails");
          listVideosRequest.setKey(apiKey);

I am not able to find a way to set chart parameter( one of the Filter option ). Actually i wanna retrieve videos list of Most popular in my region. Thanks in advance


Solution

  • Try like this. First check whether you included proper lib or not in your project. Because some times it may not show all methods. for updated library click here. Once you have updated library then

    YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet, contentDetails");
    listVideosRequest.setChart("mostPopular");
    listVideosRequest.setKey(apiKey);