1

As usual, I want to get more than 25 comment of a video by using Youtube API v2. Documents say that with start-index parameter, I can decide the interval and with maxresults parameter I can decide the max result. maxresults parameter is default 25 and is maximum 50. Iteratively i can get comments up to 1000. But, How can i change the maxresults parameter and star-index parameter in this code :

    YouTubeService service = new YouTubeService(key);
    String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/0nvfsNzV3Vc";

    VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
    String commentUrl = videoEntry.getComments().getFeedLink().getHref();

    CommentFeed commentFeed = service.getFeed(new URL(commentUrl),
            CommentFeed.class);
    for (CommentEntry comment : commentFeed.getEntries()) {
        System.out.println(comment.getPlainTextContent());
    }
4

1 回答 1

1

不记得了,我认为是(应该是)

String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/0nvfsNzV3Vc?v=2&start-index=1&max-results=25";

只需将您的开始索引设置为您想要开始的位置,然后将结果数设置为 50。

于 2013-08-26T17:45:27.443 回答