Sami
Sami

Reputation: 492

com.google.gdata.util.InvalidEntryException when max-results is in URL

I want to change max-results while retrieving comments of a video from youtube. This is my code :

    YouTubeService service = new YouTubeService(
            "CLIENT_ID");
    String str="http://gdata.youtube.com/feeds/api/videos/"+videoId;
    YouTubeQuery youtubeQuery = new YouTubeQuery(new URL(
            str));

    youtubeQuery.setMaxResults(50);
    youtubeQuery.setStartIndex(1);
    String videoEntryUrl = youtubeQuery.getUrl().toString();
    System.out.println(videoEntryUrl+"   *************");
    VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl),
                VideoEntry.class);

While creating VideoEntry object in the last row, it gives this error :

Exception in thread "main" com.google.gdata.util.InvalidEntryException: The 'max-results' parameter is not supported on this resource http://schemas.google.com/g/2005'>GDataunsupportedQueryParamThe 'max-results' parameter is not supported on this resource

My code prints the query so when it gives error query is like that :

http://gdata.youtube.com/feeds/api/videos/v_wzBsZLLaE?start-index=1&max-results=40

Why max-results parameter is not supported in this situation?

Greetings

Upvotes: 1

Views: 177

Answers (1)

Als
Als

Reputation: 1415

You are requesting video information about one video. So, for 1 video, using start-index and max-results does not make any sense. (If it would be allowed then both can only be 1.)

Upvotes: 1

Related Questions