Youtube API Ratings - youtube-api

I am using YouTube API in one of my projects. In some cases I find that the "gd$rating" is not present in the response I receive . What can be the possible reasons for this ? Is there a work around to get the same ?

This sounds like a classic example of "don't always trust the API return values to be wholly complete or accurate". You will most likely have to anticipate this sort of thing happening in your code. Even if it is defined in the API.
For example: https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_gd:rating
From the docs: gd$rating This element is only returned if the video has been rated.

Related

Youtube API search livestream stop to work

A few days that the youtube api stop to show a livestream videos, is this error only on my api key? if does, is there any other way to find a livestream videos?
I googled if there any message from youtube about this, and i didn't find.
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC4R8DWoMoI7CAwX8_LjQHig&eventType=live&type=video&key={MY_API_KEY}
You are not alone.
It's broken for everybody, unfortunately, and it's been this way for over ten days now. As with all Google services, human support and feedback is non-existent, not even an acknowledgement of the issue.
Ref.: https://support.google.com/youtube/thread/14611425
As a workaround, I had to change the logic to use the q parameter along with eventType=live. This actually works, and, depending on keywords, can also return a whole lot of unrelated live material, which, I think, can be further filtered on the client. This also seems to incur higher quota usage.
Well, I guess the issue is you try to use a meta-channel. UC4R8DWoMoI7CAwX8_LjQHig refers to what you get when you click on live in the menu, but this only "sums up" what's live, it isn't a real channel itself. Just strip the channelId parameter you should get all active live streams (only tested at reference page https://developers.google.com/youtube/v3/docs/search/list but got me 14.5k at time of try).
Matt

About YouTube search list API V3

In my application, I have used youtube.search.list API v3 for searching whole videos included in specific channel.
Example:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=[CHANNEL_ID]&q=[KEYWORD]
'q' is parameter for search keyword.
In my case, I used only 'q=' without keyword because I'd like to search whole videos.
It's working well at least until yesterday(27.Aug). but now, the server response is always 'totalResults: 0'
Could you tell me whether it's temporary wrong operation or the policy about this API is changed?
You can test above problem in the below url :
http://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet
The issue has been reported to the gdata issues list five times in the last 24 hours or so. Regardless of whether it's deliberate or not, there's a lot of people concerned.
The first instance report:
https://code.google.com/p/gdata-issues/issues/detail?id=6598

Why is the YouTube api search returning different results from different servers?

We've noticed the search results returned from the v3 search api are different depending on the location of the server. I've confirmed the code is exactly the same and when I run a test using the try-it section of the api documentary website on the different server the results are different as well. Does anyone know why?
https://developers.google.com/youtube/v3/docs/search/list#try-it
That's normal, just as you'd expect from YouTube's web search, depending on your login and location, it will find most relevant videos.
I was having the same problem. In my own computer (I'm in Brazil) the call would return 10 videos. When executed on Azure server (East-US) it would return no videos at all.
So I added the param regionCode=BR and it worked properly.
Though its very old thread, let me share my learning for others who face this.
So to keep api request generic within all servers you need to set few request parameters of youtubeapi.
RegionCode -- region to filter videos for that channel/user.
And sort result if desired.

How can you determine the URL of a youtube channel based on the channel ID?

It seems that there should be a way to do youtube.com/user/{channel id} . but I can't figure it out. I also have the GooglePlusUserId (when available) to use.
Since channel URLs aren't returned in any of the parts of the channels resource, your best bet is to construct it yourself as http://www.youtube.com/channel/UC..., where UC... is the channel id.
I'd think that would be fairly future-proof.
Edit: I hear that YouTube.com URLs might get added to v3 responses at some point in the near future, and if they do, I'd obviously recommend using that instead of constructing them manually. I'll try to remember to update this answer if they are, but you can follow https://developers.google.com/youtube/v3/revision_history to check as well.

Is it possible to get the YouTube author name for a video using the v3 api?

So I'm working on switching to using the v3 version of the YouTube api (which is so much better it's like a completely different product), but I'm either missing something or it is ...
Being able to fetch an arbitrary list of videos, and their details, in one call is going to make life significantly better, but in the videos list method, the the video details "snippet" contains the "channelId", not the "author".
I've spent quite a bit of time looking through the documentation, but can't find any way of getting from a channelId to the human readable author name.
How am I expected to map a video to an author?
It's not possible to get back a display name (either legacy YouTube name or Google+ name) for a channel as part of the video.snippet response. You need to take the channelId and perform a channels.list(id=channelId1,channelId2,...,part=snippet) operation to get that information. The good part is that you can pass in up to 50 channel ids in a single call.
This sort of separation of information into different resources with ids effectively serving as keys linking the resources was a deliberate decision. The engineering team is aware that it will require developers to make an additional API call, but they're in favor of that design.
At the same time, the API is still in an experimental release, and if you have any feedback about using the API while doing real-world development, feel free to open a feature request in the issue tracker. If enough people give feedback about a certain aspect of the API, that could factor in to the final revision's design.
The accepted answer may have been correct at the time of writing, but as of 2/2018 the snippet part now includes a channelTitle property.

Resources