gpt4 book ai didi

java - 有关 google-api-java-client 的帮助

转载 作者:行者123 更新时间:2023-12-01 16:00:12 25 4
gpt4 key购买 nike

我正在尝试解析 YouTube 视频源,并为每个视频打印其缩略图列表。我尝试过类似的事情:

 public static class VideoFeed {
@Key List<Video> items;
}

public static class Video {
@Key String title;
@Key String description;
@Key DateTime uploaded;
@Key Player player;
@Key Thumbnail thumbnail;
}

public static class Player {
@Key("default") String defaultUrl;
}



public static class Thumbnail{

List<Thumb> items = new ArrayList<Thumb>();
}

public static class Thumb extends GenericJson{
@Key("default") String defaultUrl;
@Key Integer height;
@Key Integer width;
@Key String time;

}

并打印

for (Video video : feed.items) {
System.out.println();
System.out.println("Video title: " + video.title);
System.out.println("Uploaded: " + video.uploaded);
System.out.println("URL: " + video.player.defaultUrl);

Thumbnail thumbnails = video.thumbnail;
for (Thumb thumb : thumbnails.items){

System.out.println("Thumbnail: "+thumb.defaultUrl);
}

}

但是缩略图不会被打印。

有什么问题吗?

最佳答案

是否是因为 Thumbnail.items 上缺少 @Key 注释?

关于java - 有关 google-api-java-client 的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4172348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com