我可以使用 youtube api(2.0 版)从一个请求中获取多个 youtube 视频的信息吗?
Retrieving information about a single video
从上面的链接,我可以知道如何通过id获取single
视频的信息。例如:
但是我如何从一个请求中通过他们的 id 获取两个视频信息?我已经阅读了开发人员指南,似乎没有关于我的问题的内容。 youtube api 3.0 版可以做到这一点吗?
希望大家帮帮忙! 非常感谢!
最佳答案
你应该使用 YouTube API v2.0 – Using Batch Processing .
您可以发布这样的 XML:
<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>
<id>http://gdata.youtube.com/feeds/api/videos/weRefE-qw9</id>
</entry>
<entry>
<id>http://gdata.youtube.com/feeds/api/videos/kkT-t894YSa</id>
</entry>
...
</feed>
到这个网址:
http://gdata.youtube.com/feeds/api/videos/batch
这是引用自文档:
The YouTube Data API supports batch processing, enabling you to execute up to 50 operations with a single API request rather than submit a separate request for each individual operation. A batch processing request can combine multiple query (GET), insert (POST), update (PUT) and delete (DELETE) operations. Each operation is contained within an
<entry>
tag in the request. This section explains how to format batch processing requests and handle the API responses to those requests.
关于javascript - 从一个请求中通过 id 获取多个 youtube 视频的信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16386768/