如何使用 Google API Client Library for Java 检索 YouTube 缩略图

发布于 2024-09-25 05:37:39 字数 324 浏览 0 评论 0原文

如果您能让我知道使用 Google API Client Library for Java 检索 YouTube 缩略图的方法,我将不胜感激,类似于我们使用 gdata 获取缩略图的方式。

List<String> thumbnails = new LinkedList<String>();
for (MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
    thumbnails.add(mediaThumbnail.getUrl());
}

期待, 问候, 罗尼

I would be obliged, if you could kindly let me know the means by which I can retrieve the youtube thumbnails using Google API Client Library for Java, similar to the way in which we fetched thumbnails using gdata.

List<String> thumbnails = new LinkedList<String>();
for (MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
    thumbnails.add(mediaThumbnail.getUrl());
}

Looking forward,
Regards,
Rony

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨落星ぅ辰 2024-10-02 05:37:39

使用参考页中的示例网址:

网址:http://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10& ;v=2&alt=jsonc

我们可以提取相关 JSON 片段之一的示例:

"thumbnail": {
    "sqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/default.jpg",
    "hqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/hqdefault.jpg"
}

您可以修改 要解析的示例类缩略图对象。

Using the example URL from the reference page:

URL: http://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2&alt=jsonc

we can extract an example of one of the relevant pieces of JSON:

"thumbnail": {
    "sqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/default.jpg",
    "hqDefault":"http://i.ytimg.com/vi/PpUgUrU5XUA/hqdefault.jpg"
}

You can modify the sample classes to parse the thumbnail object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文