4
votes

Can I get information of more than one youtube video from one request using youtube api (ver 2.0)?

Retrieving information about a single video

From above link, I can know how to get information of single video by its id. For example:

https://gdata.youtube.com/feeds/api/videos/ylLzyHk54Z0?v=2&fields=title,author,yt:statistics,yt:rating&alt=json

But how can I get two videos information by their ids from one request? I have read the developer guide and it seems that there is nothing about my question. Is youtube api version 3.0 able to do this?

Hope anyone can help! Thank you very much!

1

1 Answers

4
votes

You should use YouTube API v2.0 – Using Batch Processing.

You may post an XML like this:

<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>

To this URL:

http://gdata.youtube.com/feeds/api/videos/batch

This is a quote from documentation:

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.