为什么 GphotoEntry 可以工作,但 PhotoEntry 在 Picasa 网络相册 API 中返回空值?
我遇到了与 Simplyi 此处。看来他从未得到回答,而且我在这个网站上找不到这个问题,所以我想我应该把它放在这个社区之前。
无论出于何种原因,GphotoEntry 都可以工作,但 PhotoEntry 不会返回任何内容。我需要在 PhotoEntry 上使用 getMediaSource() 方法;它不适用于 GphotoEntry。
这是我的代码(它必须位于 try-catch 语句中,但我已在此处将其取出)。您会注意到我已经注释掉了对我有用的行:
URL baseSearchUrl = new URL("https://picasaweb.google.com/data/feed/api/all");
Query myQuery = new Query(baseSearchUrl);
myQuery.setStringCustomParameter("kind", "photo");
myQuery.setMaxResults(10);
myQuery.setFullTextQuery("puppy");
AlbumFeed searchResultsFeed = myService.query(myQuery, AlbumFeed.class);
//for (GphotoEntry photo : searchResultsFeed.getEntries()) {
for (PhotoEntry photo : searchResultsFeed.getPhotoEntries()) {
System.out.println(photo.getTitle().getPlainText());
}
我感谢您的帮助
I have the exact same issue as simplyi has here. It appears he has never been answered and I couldn't find this question on this site so I figured I'd put it before this community.
For whatever reason, GphotoEntry works but a PhotoEntry returns nothing. I need to use the getMediaSource() method on the PhotoEntry; it's not available for GphotoEntry.
Here's my code (it has to be in a try-catch statement, but I've taken that out here). You'll noticed that I've commented out the line that works for me:
URL baseSearchUrl = new URL("https://picasaweb.google.com/data/feed/api/all");
Query myQuery = new Query(baseSearchUrl);
myQuery.setStringCustomParameter("kind", "photo");
myQuery.setMaxResults(10);
myQuery.setFullTextQuery("puppy");
AlbumFeed searchResultsFeed = myService.query(myQuery, AlbumFeed.class);
//for (GphotoEntry photo : searchResultsFeed.getEntries()) {
for (PhotoEntry photo : searchResultsFeed.getPhotoEntries()) {
System.out.println(photo.getTitle().getPlainText());
}
I appreciate your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题。
解决方案:
将
photos-meta.jar
添加到类路径后,它应该可以工作。这里是信息来源
I came across the same problem.
Solution:
Once you add the
photos-meta.jar
to your classpath, it should work.Here is information source
对于Android,您应该使用GPhoto,对于Java,您可以使用PhotoEntry或AlbumEntry。
也许 Google 会更新 Picasa 网络相册 API 的新版本,
所以这里有很多新类,GPhoto 是第一个。
For Android, u should use GPhoto, as for Java, u can use PhotoEntry or AlbumEntry.
Maybe Google update new version for Picasa Web Album API,
So there are many new class here, GPhoto is the first one.