我有一个小型 AppEngine 应用程序,可让我将 YouTube 视频添加到 YouTube 播放列表中。该应用程序通过Java client library使用YouTube数据API 。该应用程序运行得很好,直到几周前出现了一些问题,当时 API 发生了某种变化,并且有必要更新 gdata jar 来解决问题。然而,有一个持续存在的错误不断出现。
对于某些视频,应用程序会抛出 InvalidEntryException。 响应正文是
<errors xmlns='http://schemas.google.com/g/2005'>
<error>
<domain>GData</domain>
<code>InvalidEntryException</code>
<internalReason>Validation failed</internalReason>
</error>
</errors>
我无法找到有关此错误的任何信息。另外,视频似乎也没有问题。
负责将视频添加到播放列表的代码:
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/" + videoId;
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
PlaylistEntry playlistEntry = new PlaylistEntry(videoEntry);
String playlistURL = "http://gdata.youtube.com/feeds/api/playlists/" + playlistId;
service.insert(new URL(playlistURL), playlistEntry);
调用 service.insert
时抛出错误。
最佳答案
我向 Google 报告了该问题,结果发现这是一个错误。感谢 YouTube 团队很快就修复了这个问题。该异常不再出现。
关于java - 将 YouTube 视频添加到播放列表会引发 InvalidEntryException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6293010/