1 year ago

#66345

test-img

Andreas Göbel

Youtube Data API - PlayListItems: list returns duplicated entries and hide other uploaded videos

I'm using the youtube data api (v3-rev222-1.25.0) to list all videos from the 'uploads' playlist of an youtube channel. The result of this request is a list with duplicated entries (see below). Even worse, these entries also hide other uploaded videos. Bottom line is, the list doesn't show all videos uploaded for a channel.

The URL for the 'uploads' play list is: https://www.youtube.com/playlist?list=UU_G9FS-HSMW6Jm-R4mwf8ng

String nextPageToken = null;
do {
    PlaylistItemListResponse response = getService().playlistItems()
            .list("snippet,contentDetails")
            .setPlaylistId("UU_G9FS-HSMW6Jm-R4mwf8ng")
            .setMaxResults(25L)
            .setPageToken(nextPageToken)
            .execute();
    nextPageToken = response.getNextPageToken();
    for (PlaylistItem item: response.getItems())
        System.out.println(item.getSnippet().getPosition() + "\t" +
                item.getId() + "\t" +
                item.getContentDetails().getVideoId() + "\t" +
                item.getSnippet().getTitle());
} while(nextPageToken != null);

This code snipped outputs the following lines (excerpt). You can see, there are some duplicated entries with the same playlist id and with the same vidoe id but with a different position within the playlist 'uploads'. There are much more such duplicated entries.

...
1076    VVVfRzlGUy1IU01XNkptLVI0bXdmOG5nLl9TblRlQU84aHFN    _SnTeAO8hqM
...
1126    VVVfRzlGUy1IU01XNkptLVI0bXdmOG5nLl9TblRlQU84aHFN    _SnTeAO8hqM
...
1163    VVVfRzlGUy1IU01XNkptLVI0bXdmOG5nLl9TblRlQU84aHFN    _SnTeAO8hqM
...
1017    VVVfRzlGUy1IU01XNkptLVI0bXdmOG5nLjBRRlozUmI3blgw    0QFZ3Rb7nX0
...
1065    VVVfRzlGUy1IU01XNkptLVI0bXdmOG5nLjBRRlozUmI3blgw    0QFZ3Rb7nX0
...

Can anyone determine what the problem is?

java

youtube-api

youtube-data-api

0 Answers

Your Answer

Accepted video resources