【问题标题】:Youtube api "Invalid entry Id/Uri" with batch request带有批处理请求的 Youtube api“无效条目 ID/Uri”
【发布时间】:2012-10-12 16:49:39
【问题描述】:

我正在使用 youtube-api 并发出以下批处理 POST 请求:

https://gdata.youtube.com/feeds/api/users/batch?v=2.1

与身体:

<feed xmlns='http://www.w3.org/2005/Atom'
      xmlns:media='http://search.yahoo.com/mrss/'
      xmlns:batch='http://schemas.google.com/gdata/batch'
      xmlns:yt='http://gdata.youtube.com/schemas/2007'>
  <batch:operation type="query"/>
  <entry>
    <batch:operation type="query"/>    <id>http://gdata.youtube.com/feeds/api/videos/h5jKcDH9s64</id>
  </entry>
</feed>

但在响应中出现错误。部分回复:

<title>Error</title>
<content>Invalid entry Id/Uri</content>
<batch:operation type='query'/>
<batch:status code='400' reason='Invalid entry Id/Uri'/>

单个 GET 请求: http://gdata.youtube.com/feeds/api/videos/h5jKcDH9s64

正常工作。

有人知道是什么问题吗?

【问题讨论】:

    标签: youtube-api


    【解决方案1】:

    您没有发布到正确的 URL。批量请求视频条目,需要POST到https://gdata.youtube.com/feeds/api/videos/batch?v=2

    请求正文应如下所示

    <feed xmlns='http://www.w3.org/2005/Atom'
          xmlns:batch='http://schemas.google.com/gdata/batch'>
      <batch:operation type="query"/>
      <entry>
        <id>http://gdata.youtube.com/feeds/api/videos/VIDEO_ID</id>
      </entry>
      <entry>
        <id>http://gdata.youtube.com/feeds/api/videos/VIDEO_ID</id>
      </entry>
    </feed>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-02-09
      • 2020-12-22
      • 1970-01-01
      • 2013-03-25
      • 1970-01-01
      • 1970-01-01
      • 2015-03-14
      相关资源
      最近更新 更多