Youtube iframe api v3 restrictions - youtube-api

Is there way to filter search results for videos that can be played from a certain country in youtube iframe api v3?
This call is not working:
search.setRegionCode("TR");

There is not a filter for it as of now, but from the videos in the response,
1) Do a videos.list call with id = comma separated list of all videoIds returned in your first call.
2) You can filter them by contentDetails.regionRestriction

Related

YouTube Api v3: calculate youtube playlist length

How can i get a youtube playlist duration (the sum of all it's videos durations).
I used this endpoint to get the playlist videos :
https://youtube.googleapis.com/youtube/v3/videos?playlistId
and it's return the videos object with all videos ids, in this case i need to make an api call to get each video length with separate api call to :
https://youtube.googleapis.com/youtube/v3/videos
I searched for a solution for this and found that we can make a call to previous api with all ids each id with a query param ex. id=aaaaa&id=bbbbb, but i need to be the owner of these videos to make the request.
Is there any way to get all videos with one call and without being the owner of the videos ?

How list all videos from a YouTube channel?

https://www.googleapis.com/youtube/v3/channels?id=UC_x5XG1OV2P6uZZ5FSM9Ttw&part=snippet%2CcontentDetails%2Cstatistics&key={YOUR_API_KEY}
Using this API link, I get a list of videos from start but not all videos. I only get 300 to 500 videos.
This is a bit complicated. You have to make a few calls instead.
find the channel ID of the channel you want.
list playlists (youtube.channels.list set id to channelId and set part to contentDetails)
find the ID of the playlist with name uploads
list playlist items (youtube.playlistItems.list set playlistId and set part to snippet optionally set maxResults to 50)
Page through results using nextPageToken
Found this from here https://stackoverflow.com/a/27872244/975887
Hope this helps.

Search in youtube by using youtube api

I need to retrieve videos that contain some topic in title or description ,
I use the following request
https://www.googleapis.com/youtube/v3/search?part=snippet&q=???&channelId=???&key=???
it return result that not related to the query that I mentioned
Where is the problem?
How api retrieve the result ??

Tags (keywords) are missing from the Youtube API video feed when using category search

When I make an authorized call for Youtube videos, I get all the tags/keywords in the feed.
http://gdata.youtube.com/feeds/api/users/default/uploads?alt=jsonc&v=2
However, if I want to filter this result by a single keyword/category, the tags are not returned by the API. Example, I want to reduce the number of videos in the feed by tag "English"/"French".
http://gdata.youtube.com/feeds/api/users/default/uploads/-/English?alt=jsonc&v=2
Is this expected behavior or a bug?
It's expected behavior; this blog post explains how your second request is going against the search index, which will never return keywords/tags in the response.

Filter YouTube video feed by duration using GData

I am using the GData API method
- (GDataServiceTicket *)fetchFeedWithQuery:(GDataQuery *)query
delegate:(id)delegate
didFinishSelector:(SEL)finishedSelector;
to fetch YouTube videos. I am trying to filter the search feed by duration. For example, I want the feed to only return videos longer than, say, 20 minutes. Is there a way to do this?
1) You can achieve this using YouTube Data API v3 by using videoDuration = long
Your request will be something similar to "GET https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&videoDuration=long&key={YOUR_API_KEY}"
2) If you want finer grain search on duration you can iterate videos with video list query and check videoDuration on each.

Resources