videoChartNotFound error for some video categories - youtube

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.

Related

Youtube API - Video Category ID assignables

i would like to ask a question regarding the difference between "assignable": true and "assignable":false. There are some videoCategory IDs that are marked as "assignable":false and can't be pulled via the API call.
Could you advice on this as there are some videoCategories that are key to our search. Thank you!
According to the docs, assignable is true if and only if the respective category is actually attributable (assignable) to any video's meta data.
In other words, one can call for endpoints Videos.insert or Videos.update setting (assigning) snippet.categoryId if and only if that category ID identifies a video category that has its property assignable set to true.

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

Cant find Youtube data v3 for channel list

Friends,
I want to search in the query, channels that belong to a certain category (categoryId).
In the example of the app console(https://developers.google.com/apis-explorer/),its ok.
But when I try to run the task with my key, the search returns no result.
i use this key:
https://www.googleapis.com/youtube/v3/channels?part=snippet&categoryId=GCQmVhdXR5ICYgRmFzaGlvbg&key={YOUR_API_KEY}
Try to use the videoCategoryId parameter which filters video search results based on their category. If you specify a value for this parameter, you must also set the type parameter's value to video.
You may encounter a badRequest (400) invalidSearchFilter error if the request contains an invalid combination of search filters and/or restrictions.
Note that you must set the type parameter to video if you set a value for the eventType, videoCaption, videoCategoryId, videoDefinition, videoDimension, videoDuration, videoEmbeddable, videoLicense, videoSyndicated, or videoType parameters.

Getting some data from Microsoft Graph unified OData endpoint

How to count number of items in EntitySet of MicrosoftGraph, for example 'users' or 'groups'? I tried:
https://graph.microsoft.com/v1.0/users?$count
Returns: lists all users
https://graph.microsoft.com/v1.0/users/$count
Returns:
{ "error": { "code": "Request_BadRequest", "message": "Unexpected segment Edm.Int32.", } }
Also in Annotations of target "microsoft.graph.directoryObject" which are those EntitySets based on I see that it is Selectable=false, Countable=false ...
Will $skip be ever available on 'users' or other toplevel EntitySet items ( https://graph.microsoft.com/v1.0/groups?$skip=5 ) ? It is available on other items ( https://graph.microsoft.com/v1.0/me/contacts?$skip=5 ). I know about $skipToken, but it is not the same.
Can I find somewhere in the $metadata if property is sortable? For example user.displayName is sortable, but user.mail or user.givenName are not. This would be handy in the $metadata. Is there plan to introduce this into $metadata?
OrderBy DESC in this formula https://graph.microsoft.com/v1.0/users?$orderBy=displayName%20desc is ignored, it shows items ordered ASC, am I doing something wrong?
Not much help I know, but if you do an API call that gets a Collection you can get a count using the second form you gave in the first question. Eg:
https://graph.microsoft.com/v1.0/users/<id>/events/$count
returns the count (6 in my case, and not in JSON - the returned data is actually "\x{ef}\x{bb}\x{bf}6" (in Perl formatting)). If we use the ? as the last separator (which is what http://graph.microsoft.io/en-us/docs/overview/query_parameters seems to indicate we should) with this URL:
https://graph.microsoft.com/v1.0/users/<id>/events?$count
I just get the list of events with no count as you do.
So that seems to indicate two things to me:
a) The $count doesn't appear to work as a query parameter, despite the documentation and the OData standards saying it should,
and
b) There seems to be a bug in the API for handling EntitySets which isn't there for Collections.
Sorry I can't be of more help, but its another data point at least (I just came unstuck with the same thing which is why I noticed this StackOverflow post!)
Ad 1. https://graph.microsoft.com/v1.0/users/$count is the correct OData syntax (http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398087), but as indicated in the metadata directoryObject collections are not currently countable. ODataV4 also allows $count in query parameters (http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398166), but then it should be specified with true or false value (e.g. https://graph.microsoft.com/v1.0/me/events?$count=true) and the response will include both the collection and its count in the #odata.count property. This is again not supported for directoryObject collections.
Ad 2. There is no plan right now to support $skip for directoryObject collections.
Ad 3. Yes, we plan to indicate which properties are sortable by in metadata using the SortRestrictions annotation defined in the OData capabilities vocabulary (http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/vocabularies/Org.OData.Capabilities.V1.xml)
Ad 4. Your request is correct, but we only support sorting users by displayName in the ascending order.

Resources