How can I solve Video Rating Disabled? - youtube

I'm doing a project using the YouTube Data API's Videos.rate endpoint.
And I got some problems: some particular minor channels (e.g. my client's channel) are sending error messages:
{
"error": {
"code": 403,
"message": "The owner of the video that you are trying to rate has disabled ratings for that video.",
"errors": [
{
"message": "The owner of the video that you are trying to rate has disabled ratings for that video.",
"domain": "youtube.video",
"reason": "videoRatingDisabled",
"location": "id",
"locationType": "parameter"
}
]
}
My boss wants to help them to solve that problem, but I don't know how to solve this at all. There is no problem with other major channels with 1M+ subscriptions.
I did my best to google this problem, yet couldn't find good results until now.

Before rating the video, check if the vide has enabled the rating.
I can't test right now, but, and idea could be:
Use getRating and check the items[].rating value - if the result is none or unspecified, then, you have to handle your logic for make them know that this video can't be rated - due its owner disabled rating their video.
The message you show in your question says that you cannot rate that video because the owner doesn't allow it. YouTube Data API wont bypass such restriction and there's not much that can be done further.
Ask your boss (or the owner of the video) about allow rating their video(s) and then verify if the video can be rated, if so, try again rate the video.

Related

Youtube Data API V3 - Uploading video through PHP code shows error

I've been using following code since a year now but suddenly this errors started appearing.
I'm using PHP Code sample provided in following url
https://developers.google.com/youtube/v3/code_samples/php#upload_a_video
ERROR:
{
"error": {
"errors": [{
"domain": "youtube.thumbnail",
"reason": "videoNotFound",
"message": "The video that you are trying to insert a thumbnail image for cannot be found. Check the value of the requests \u003ccode\u003evideoId\u003c/code\u003e parameter to ensure that it is correct.",
"locationType": "parameter",
"location": "videoId"
}],
"code": 404,
"message": "The video that you are trying to insert a thumbnail image for cannot be found. Check the value of the requests \u003ccode\u003evideoId\u003c/code\u003e parameter to ensure that it is correct."
}
}
I've print statement just before this error catching, and I could see the video ID. And I could see a wiered behavior on my video url.
https://www.youtube.com/watch?v=KV-5aiMDLDg
No comment box, no suggested videos.
Anyone else facing this issue, is there an error/Bug reported recently from Youtube?
I am having the exact same problem. Code has been running fine forever, and now is failing. I added a 20 second delay after the video upload completes, before the thumbnail is set, and it seems to always work now. So it acts like Youtube needs time to digest the video. Would love to hear a better solution though.

ErrorItemNotFound when trying to retrieve room calendar via MS Graph API

Next to retrieving calendar views of a user's calendar (on behalf of the user), we are trying hard to also get the calendar view of rooms via the Graph API using
https://graph.microsoft.com/beta/users/room1#ourdomain.com/calendarView. It's a painful process since we've been running into many problems and are currently stuck with the following 404 response:
https://graph.microsoft.com:443/v1.0/users/room1#ourdomain.com/calendarView?startDateTime=2018-12-04T23:00:00.000Z&endDateTime=2019-02-10T22:59:59.999Z
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"request-id": "358a003a-57a4-4f0e-91da-edc17c1fa2d8",
"date": "2018-12-12T07:38:33"
}
}
}
The email address of the room has been double checked and the resource exists, since we can create appointments with it and it is even being returned in the response when we retrieve the calendar of the user who has an appointment in that location.
App permissions and OAuth2 scopes are set to: openid email profile offline_access https://graph.microsoft.com/Calendars.Read https://graph.microsoft.com/Calendars.Read.Shared https://graph.microsoft.com/User.Read
https://graph.microsoft.com/User.ReadBasic.All https://graph.microsoft.com/User.Read.All, so that should not be an issue, judging by the documentation.
Does anyone know how to solve this?
I've tried all possible ways, but there is no way to get access.
This is what I've tried out the following in the Graph explorer:
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/events -> DelegatedCalendarAccessDenied
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/calendarView?startDateTime=2019-01-14&endDateTime=2019-01-18 -> ErrorItemNotFound
https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com/calendar/calendarView?startDateTime=2019-01-14&endDateTime=2019-01-18 -> ErrorItemNotFound
All three on both the v1.0 and the beta.
It isn't an issue with rights, because for my testing I granted the Graph Explorer the Directory.ReadWrite.All scope. Resulting in the following scp claim.
The first requests seems the most promising (because of the different error), I also made myself a delegate with full control of the rooms-mailbox. That still didn't help.
A request to https://graph.microsoft.com/v1.0/users/meetingroom1#domain.com gives a result, as in a result describing the meetingroom.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"businessPhones": [],
"displayName": "Meeting room 1",
"givenName": null,
"jobTitle": null,
"mail": "meetingroom1#domain.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "meetingroom1#domain.com",
"id": "3e0a7b7e-xxxx-xxxx-xxxx-xxxxcxxxx120"
}
After doing all these tests, I can only conclude that you cannot access the events in a rooms mailbox. This is either intended (as in only use the scheduling assistant) or a bug.
Maybe some of the Microsoft guys around here could clarify this?
FINALLY! After going through this with countless Microsoft support people, each of whom said this was not their territory and did not know where to forward the question, I got in touch with somebody from the Exchange team. He suggested the one thing that worked for us: the user on behalf of which you are retrieving the room resource calendar needs to be a delegate of that room resource!
In addition, to retrieve the list of room resources which the user can select from, we needed to use the findRooms endpoint but this only works on the beta API. The only drawback of this is that you cannot seem to filter for rooms of which the user is a delegate. So the user will get a list of rooms for which he might or might not be able to retrieve the calendar.
A final drawback of the room resource calendarView response is that the response does not contain the names of the meetings planned in the rooms. The description of each event only contains the name of the meeting organizer.

Youtube video id (or URL) to "user" and "channel"

Given a URL or ID of a Youtube video, is it possible to get the (1) name of the "user" who had uploaded it and (2) channel that it belongs to? If so, what is the API request?
So, for example: lets' say I have a video ID: "VulCl5QfewE" corresponding to the video at: https://www.youtube.com/watch?v=VulCl5QfewE
I then want to extract the name of the user, which is: "TheYoungTurks" and the URL of the user is:
https://www.youtube.com/user/TheYoungTurks
I also want to be able to extract the name of the channel, which is: "UC1yBKRuGpC1tSM73A0ZjYjQ" and the URL of the channel is:
https://www.youtube.com/channel/UC1yBKRuGpC1tSM73A0ZjYjQ
Finally, (as a "side, ancillary question") I am a bit confused what is the difference between a "channel" and a "user". Can a user have multiple channels? I did read the link here: https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/ but I am trying to understand the use case behind it.
Cheers
If you want to retrieve the channel informations from a videoId, you need to use the ressource videos.list with the parameters:
part: snippet
id: "VulCl5QfewE" //for example
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VulCl5QfewE&key={YOUR_API_KEY}
The result show you the channelID of the user:
"items": [
{
"kind": "youtube#video",
"etag": "\"iDqJ1j7zKs4x3o3ZsFlBOwgWAHU/IcNtD4uunskZTQuIeM0YQRcc5HY\"",
"id": "VulCl5QfewE",
"snippet": {
"publishedAt": "2015-08-05T01:11:24.000Z",
"channelId": "UC1yBKRuGpC1tSM73A0ZjYjQ",
Then use this information to get the name of the channel with the ressource channel.list
part: snippet
id: UC1yBKRuGpC1tSM73A0ZjYjQ
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=UC1yBKRuGpC1tSM73A0ZjYjQ&key={YOUR_API_KEY}
Part of the result:
"snippet": {
"title": "The Young Turks",
"description": "The Largest Online News Show in the World. Hosted by Cenk Uygur & Ana Kasparian. LIVE weekdays 6-8pm ET. \n\nYoung Turk (n), 1. Young progressive or insurgent member of an institution, movement, or political party. 2. Young person who rebels against authority or societal expectations. (American Heritage Dictionary)\n\nThe Young Turks were the first original talk show on Sirius satellite radio and the first live, daily webcast on the internet. But that is not the revolution.\n\nWe are a rare show that combines all of the news that people care about in one place. We are not afraid to talk about politics and entertainment and sports and pop culture. But that is not the revolution either. \n\nGet The Young Turks\u200b Mobile App Today! \n\nDownload the iOS version here: https://itunes.apple.com/us/app/the-young-turks/id412793195? \n\nDownload the Android version here: https://play.google.com/store/apps/details?id=com.tyt",
"publishedAt": "2005-12-21T20:46:51.000Z",
Finally, (as a "side, ancillary question") I am a bit confused what is
the difference between a "channel" and a "user". Can a user have
multiple channels? I did read the link here:
https://www.reddit.com/r/youtube/comments/2vsyit/whats_the_difference_between_user_and_channel/
but I am trying to understand the use case behind it.
There is a link with Google+ account, check https://productforums.google.com/forum/#!topic/youtube/3MsBApaK2Hw

Quota Limits For You-Tube Data API V3?

The new Google Developers console shows the following limit for YouTube Data API v3:
PER USER LIMIT 2 requests/second/user
Whereas the old Google Developers console shows:
2.0 units/second/user
(i.e. one is requests per second, the other is units per second which are quite different).
From - https://developers.google.com/youtube/v3/determine_quota_cost - the Search request appears to have a cost of 200 units, if the latter case above is correct would this mean we can only make one of these requests every 100 seconds?
This does seem to tie in more closely with what we are experiencing which is regular occurrences of the following 403 forbidden error after paging through only a few results from a YouTube search:
"error": {
"errors": [
{
"domain": "youtube.quota",
"reason": "quotaExceeded",
"message": "Quota Exceeded"
}
],
"code": 403,
"message": "Quota Exceeded"
}
}
The new console is right on this point. It's request/sec.
But you may have been hitting daily quota limits.
Remember that in many cases, you can substitute a less costly call, such as youtube.videos.list, in place of the youtube.search.list method. For example, to search most popular videos instead of the search.list call, you can use the videos.list call using the most popular chart.
you can contact youtube and apply for higher quota or pay for higher quota

YouTube API - No channel branding settings returned for queries by username

When using the YouTube API v3 to query a channel's branding settings, why are they returned for queries by channel ID, but not for queries by username? The API doesn't return branding settings for channel list queries by username.
If you query for a channel's branding settings by channel ID (e.g., id=UC8-Th83bH_thdKZDJCrn88g), you are returned a complete set of branding settings:
Google API Explorer: https://developers.google.com/youtube/v3/docs/channels/list
Request
GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id=UC8-Th83bH_thdKZDJCrn88g&key={YOUR_API_KEY}
Response
{
// ... snip ...
"items": [
{
"kind": "youtube#channel",
"etag": "\"...\"",
"id": "UC8-Th83bH_thdKZDJCrn88g",
"brandingSettings": {
"channel": {
"title": "The Tonight Show Starring Jimmy Fallon",
"description": "Watch The Tonight Show Starring Jimmy Fallon Weeknights 11:35/10:35c\n\nThe Tonight Show Starring Jimmy Fallon features hilarious highlights from the show including: comedy sketches, music parodies, celebrity interviews, ridiculous games, and, of course, Jimmy's Thank You Notes and hashtags! You'll also find behind the scenes videos and other great web exclusives.",
// all the branding settings are here
}
}
}]
}
If, on the other hand, you send a channel list query for a username (e.g., forUsername=latenight), you get no branding settings at all. The branding settings aren't returned or populated.
Request
GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&forUsername=latenight&key={YOUR_API_KEY}
Response
{
// ... snip ...
"items": [
{
"kind": "youtube#channel",
"etag": "\"...\"",
"id": "UC8-Th83bH_thdKZDJCrn88g"
}]
}
I may be wrong, but I believe that, in v3 of the APIs, Channel IDs are the only way to get a full response, as the concept of a "username" doesn't really exist in the same way anymore. That is, newly created YouTube channels are linked to a G+ profile and can have a display name, but there isn't really any YouTube username anymore associated with such a channel.
Because usernames used to exist, though, and many channels are still known by them, the "forUsername" parameter is there to provide you the associated channelID and then issue the request for the branding settings with that.
Now, having said that, it's clear that the language on the API explorer page doesn't reflect that, and perhaps therein lies the problem; I'm taking my inferences from this documentation:
https://developers.google.com/youtube/v3/guides/working_with_channel_ids#v3
and from this bug report:
https://code.google.com/p/gdata-issues/issues/detail?id=4821&q=forUsername&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary
But it's always possible, too, that I'm reading incorrectly and you're actually seeing a new bug. The only way to know for sure would be to file it (or perhaps someone on the team could comment here)?

Resources