本文整理了Java中com.google.api.services.youtube.YouTube.playlistItems()
方法的一些代码示例,展示了YouTube.playlistItems()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTube.playlistItems()
方法的具体详情如下:
包路径:com.google.api.services.youtube.YouTube
类名称:YouTube
方法名:playlistItems
[英]An accessor for creating requests from the PlaylistItems collection.
The typical use is:
YouTube youtube = new YouTube(...); YouTube.PlaylistItems.List request = youtube.playlistItems().list(parameters ...)
[中]用于从PlayItems集合创建请求的访问器。
典型用途是:
YouTube youtube = new YouTube(...); YouTube.PlaylistItems.List request = youtube.playlistItems().list(parameters ...)
代码示例来源:origin: eneim/toro
void refresh() throws IOException {
Disposable disposable = //
Observable.just(ytApi.playlistItems()
.list(YOUTUBE_PLAYLIST_PART)
.setPlaylistId(YOUTUBE_PLAYLIST_ID)
.setPageToken(null)
.setFields(YOUTUBE_PLAYLIST_FIELDS)
.setMaxResults(YOUTUBE_PLAYLIST_MAX_RESULTS)
.setKey(API_KEY) //
)
.map(AbstractGoogleClientRequest::execute)
.map(PlaylistItemListResponse::getItems)
.flatMap(playlistItems -> Observable.fromIterable(playlistItems)
.map(item -> item.getSnippet().getResourceId().getVideoId()))
.toList()
.map(ids -> ytApi.videos().list(YOUTUBE_VIDEOS_PART).setFields(YOUTUBE_VIDEOS_FIELDS) //
.setKey(API_KEY).setId(TextUtils.join(",", ids)).execute())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnError(
throwable -> Log.e(TAG, "accept() called with: throwable = [" + throwable + "]"))
.doOnSuccess(
response -> Log.d(TAG, "accept() called with: response = [" + response + "]"))
.onErrorReturnItem(new VideoListResponse()) // Bad work around
.doOnSuccess(liveData::setValue)
.subscribe();
disposables.add(disposable);
}
}
代码示例来源:origin: Kaaz/DiscordBot
public List<SimpleResult> getPlayListItems(String playlistCode) {
List<SimpleResult> playlist = new ArrayList<>();
try {
YouTube.PlaylistItems.List playlistRequest = youtube.playlistItems().list("id,contentDetails,snippet");
playlistRequest.setPlaylistId(playlistCode);
playlistRequest.setKey(search.getKey());
playlistRequest.setFields("items(contentDetails/videoId,snippet/title,snippet/publishedAt),nextPageToken,pageInfo");
String nextToken = "";
do {
playlistRequest.setPageToken(nextToken);
PlaylistItemListResponse playlistItemResult = playlistRequest.execute();
playlist.addAll(playlistItemResult.getItems().stream().map(playlistItem -> new SimpleResult(playlistItem.getContentDetails().getVideoId(), playlistItem.getSnippet().getTitle())).collect(Collectors.toList()));
nextToken = playlistItemResult.getNextPageToken();
} while (nextToken != null);
} catch (IOException e) {
e.printStackTrace();
}
return playlist;
}
代码示例来源:origin: UdacityAndroidBasicsScholarship/wmn-safety
playlistItemListResponse = mYouTubeDataApi.playlistItems()
.list(YOUTUBE_PLAYLIST_PART)
.setPlaylistId(playlistId)
代码示例来源:origin: youtube/yt-direct-lite-android
PlaylistItemListResponse pilr = youtube.playlistItems()
.list("id,contentDetails")
.setPlaylistId(uploadsPlaylistId)
内容来源于网络,如有侵权,请联系作者删除!