Java 中的 YouTube MediaThumbnail 质量
我想在使用 Java 中的 VideoEntry 时从可用的缩略图中获得最高质量的缩略图。
我正在使用 gdata 库。
我知道最好的一个是 xml 中具有属性 yt:name="hqdefault" 的属性,但我不知道如何从代码中的 MediaThumbnail 获取该属性值。
MediaThumbnail 类中没有相应的方法。
我的目标是如果可用则使用“hqdefault”,如果不可用则使用“默认”。 到目前为止,我使用的是缩略图列表中的第一个,但据我了解,它不一定是“默认”列表,因为列表可以按随机顺序出现。
有没有办法在不解析 url 的情况下找出 MediaThumbnail 的质量?
I want to get the highest quality thumbnail from the ones available while working with VideoEntry in Java.
I'm using the gdata libraries.
I know that the best one is the one with the attribute yt:name="hqdefault" in the xml but I have no idea how to get that attribute value from the MediaThumbnail in code.
There is no method for that in the MediaThumbnail class.
My goal is to use the "hqdefault" one if it's available and if not then use the "default" one.
So far I'm using the first from the thumbnail list, but as I understand it won't necessarily be the "default" one since the list can come in a random order.
Is there any way to find out the quality of the MediaThumbnail without parsing the url?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下代码列出了视频的所有可能的缩略图。选择适合您的。
Following code lists all possible thumbnails for a video. Choose whichever is suitable for you.