Youtube API, iOS. Get items from 2 playlist - ios

I have playlist A and playlist B.
Can I request for items from A and B in one request? I need to get mix of this playlists

This is an other example where checking the documentation will help
PlayLists.list
id string The id parameter specifies a comma-separated list of the
YouTube playlist ID(s) for the resource(s) that are being retrieved.
In a playlist resource, the id property specifies the playlist's
YouTube playlist ID.
you can send more then one play list id you just need to separate them with a comma. Use the try me at the bottom of the page to test it.

Related

YouTube API: How to get the channel id by channel name?

Is it somehow possible to get the channel ID by a channel name (www.youtube.com/somechannelname)? In my case I only have the channel name, but have to retrieve data from the channel (but for this I need the ID).
See: How can I get a channel ID from YouTube?
To obtain the channel id you can view the source code of the channel
page and find either
data-channel-external-id="UCjXfkj5iapKHJrhYfAF9ZGg" or
"externalId":"UCjXfkj5iapKHJrhYfAF9ZGg".
UCjXfkj5iapKHJrhYfAF9ZGg will be the channel ID you are looking for.

How to retrieve videos from playlist from particular category

How to retrieve videos from a playlist from a particular category? Is that even possible to do?
I did try this call :
https://www.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&maxResults=50&myRating=like&chart=mostPopular&videoCategoryId=10
But no luck
You may use the Search: list method which returns a collection of search results that match the query parameters specified in the API request.
By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource.

How to get youtube metadata while playing using video.js 7

Video.js provides a method to get video metadata such as player.duration(). This works for regular mp4 videos. Is it possible to get information about license and title of YouTube videos?
You may check in this link the list of parameters that this query (Videos: list) supports.
The part parameter specifies a comma-separated list of one or more video resource properties that the API response will include.
If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a video resource, the snippet property contains the channelId, title, description, tags, and categoryId properties. As such, if you set part=snippet, the API response will contain all of those properties.

How to get the end screen element with an end_screen_element_id from Youtube API

With a channel reporting job, we can get the end_screen_element_ids for a given video. These IDs look like GUIDs.
The question is : How do we query the Youtube API to get what video/channel/... these end_screen_element_ids points to ?
Thanks!
You may use the reportTypes.list method. This returns a list of report types that the channel or content owner can retrieve. Each item in the list contains an id property, which identifies the report's ID, and you need this value to schedule a reporting job.

videoChartNotFound error for some video categories

API calls https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=US&key=API_KEY can retrieve a list of available videoCategory for certain country.
For example, videoCategory id 43:
However, when i retrieve video by this videoCategory id 43, for example https://www.googleapis.com/youtube/v3/videos?part=snippet%2C+contentDetails&chart=mostPopular&regionCode=MY&videoCategoryId=43&key=API_KEY, i get error instead:
At the first glance, i thought it was due to assignable is false, but it's not the case, because some videoCategoryId which was assignable=false can retrieve videos too.
videoCategoryId id 30, assignable is false:
videoCategoryId 30 have no problem to get videos:
Search API is ok(some categories return only ~2 videos), for example this API calls, https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=20&order=relevance&videoCategoryId=43&type=video&key=API_KEY:
I'm not sure it's bug or not. Because it's possible videoCategory id 43 is not under mostPopular chart and lead to this error. But how is it possible to detect and filter it out on videoCategories resource API? there's no flag to indicate this category cannot work with video resource API.
I ran into this as well, and it seems that the bug is that "Movies" and "Trailers" should be set as assignable. Per this, https://developers.google.com/youtube/v3/docs/videoCategories, if a category is assignable it has videos associated with it. So it makes sense that retrieving videos for non-assignable categories would fail, but it does not make sense that those two non-assignable categories do, in fact, have associated videos (although "Trailers" only returns one result, which is strange).
I suppose a temporary workaround is to just include assignable categories, and manually include movies and trailers.

Resources