【问题标题】:Adding YouTube video to a playlist throws InvalidEntryException将 YouTube 视频添加到播放列表会引发 InvalidEntryException
【发布时间】:2023-03-24 02:47:01
【问题描述】:

我有一个小型 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时会抛出错误。

【问题讨论】:

    标签: java youtube youtube-api gdata-api


    【解决方案1】:

    我向 Google 报告了这个问题,结果证明这是一个错误。感谢 YouTube 团队很快修复了它。该异常不再出现。

    【讨论】:

      猜你喜欢
      • 2018-03-10
      • 2014-02-09
      • 2015-12-31
      • 1970-01-01
      • 1970-01-01
      • 2019-06-13
      • 1970-01-01
      • 2020-09-08
      • 1970-01-01
      相关资源
      最近更新 更多