Get information on multiple YouTube videos for a single request?

Can I get information about several YouTube videos from a single request using youtube api (ver 2.0)?

Retrieving information about a single video

From the link above, I can learn how to get information about a single video by its identifier. For instance:

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 video information by my identifiers for one request? I read the developer's guide and it seems that there is nothing in my question. Is this possible for youtube api version 3.0?

Hope anyone can help! Thank you very much!

+4
source share
1 answer

You must use the YouTube API v2.0 - Using Batch Processing .

You can place the XML as follows:

 <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 the documentation:

The YouTube Data API supports batch processing, allowing you to perform up to 50 operations with a single API request, rather than submitting a separate request for each individual operation. A batch request processing can combine multiple requests (GET), insert (POST), update (PUT), and delete (DELETE). Each operation contained in the <entry> in the request. This section explains how to format batch processing requests and process API responses to these requests.

+4
source

Source: https://habr.com/ru/post/1479258/


All Articles