not getting result from youtube channel:list api - youtube-api

I am using youtube data api (GET https://www.googleapis.com/youtube/v3/channels?part=snippet&categoryId=GCQ29va2luZyAmIEhlYWx0aA&maxResults=5&key={YOUR_API_KEY}). but getting no channel list in response. tried for so many categoryId's from different regionCode.
response from youtube api - 200
{
"kind": "youtube#channelListResponse",
"etag": "Wu2llbfqCdxIVjGbVPm2DslKPCA/ewwRz0VbTYpp2EGbOkvZ5M_1mbo",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": [
]
}

Looks like you copy pasted the URI
GET https://www.googleapis.com/youtube/v3/channels
,attached an API_KEY then pasted it on your browser.
What I would recommend is use the Try-it for testing then use OAuth for authorization when actually coding the app. You can see several Quickstarts in the Youtube Guide.

Related

How to get a User's Youtube handle after they sign in with Google?

Is there an API to retrieve a user's Youtube handle as of today?
cannot find anything in Youtube Data API doc.
One more time YouTube Data API v3 doesn't provide a basic feature. As handle isn't found for channel handles in YouTube Data API v3 revision history, while it's a recent feature.
I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?part=about&id=CHANNEL_ID, you will get the channel handle you are looking for in item["about"]["handle"].
For instance for UCQxJsAlqmBPAbR_0syDi9mg you would get:
{
"kind": "youtube#channelListResponse",
"etag": "NotImplemented",
"items": [
{
"kind": "youtube#channel",
"etag": "NotImplemented",
"id": "UCQxJsAlqmBPAbR_0syDi9mg",
"about": {
...
"handle": "#Fairphone"
}
}
]
}

how to map youtube handles to channel IDs

Youtube recently rolled out handles feature where they gave users youtube.com/#xxx type usernames, when visited these URLs show user's channel but I can't find any documentation or reference in API repositories.
How to extract youtube user channel ID from their handle?
One more time YouTube Data API v3 doesn't provide a basic feature.
I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?handle=#HANDLE you will get the YouTube channel id you are looking for in item["id"].
For instance with the YouTube channel handle #WHO, you would get:
{
"kind": "youtube#channelListResponse",
"etag": "NotImplemented",
"items": [
{
"kind": "youtube#channel",
"etag": "NotImplemented",
"id": "UC07-dOwgza1IguKA86jqxNA"
}
]
}

YouTube Data API channels list returning no results for valid Channel ID

I'm attempting to access https://www.youtube.com/channel/UC7LoiySz7-FcGgZCKBq_2vQ via the YouTube Data API v3 however am not able to load channel by id:
https://content.googleapis.com/youtube/v3/channels?part=snippet&id=UC7LoiySz7-FcGgZCKBq_2vQ&key=<omitted>
{
"kind": "youtube#channelListResponse",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/Rk41fm-2TD0VG1yv0-bkUvcBi9s\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}
other channels that this same error occurs for:
https://www.youtube.com/channel/UCzwNZaQ2qyZw0n3xOSNoXaQ
https://www.youtube.com/channel/UC0iFwqagVPP6pXiDwYU170g
Your channels are of type hidden. This is the expected outcome. Unhide it and work your way from there.
Delete or hide your YouTube channel:
You can hide content from your YouTube channel and choose to re-enable
it later. When you hide content, your channel name, videos, likes,
subscriptions, and subscribers will be made private.
All your comments and replies will be permanently deleted. Your
account data on other Google properties will not be removed.
One more time YouTube Data API v3 doesn't provide a basic feature.
I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?part=status&id=CHANNEL_ID, you will get the YouTube channel status message you are looking for in item["status"].
For instance with this channel id UC7LoiySz7-FcGgZCKBq_2vQ you would get:
{
"kind": "youtube#channelListResponse",
"etag": "NotImplemented",
"items": [
{
"kind": "youtube#channel",
"etag": "NotImplemented",
"id": "UC7LoiySz7-FcGgZCKBq_2vQ",
"status": "This channel is not available."
}
]
}
For a suspended YouTube channel such as UCF_UozwQBJY4WHZ7yilYkjA, you would get for status: "This account has been terminated due to multiple or severe violations of YouTube's policy on nudity or sexual content.".
For a normal channel, such as UC4QobU6STFB0P71PMvOGN5A, you would get for status: null.

Youtube API get a video?

I am trying to get a simple thing - a video, and i just can't understand why such a simple thing, is not clearly defined in the API docs.
To search for a video i have :
https://www.googleapis.com/youtube/v3/search?part=snippet&q=guy&key=api key
Than , i get the json, with results like :
"kind": "youtube#searchListResponse",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/_yCHjN-Yei6to4bLpd2j603Ea18\"",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 223929,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/ruSBEQPUZp3DX2M8M4bcCPny2fc\"",
"id": {
"kind": "youtube#video",
"videoId": "J0tGubH9ZyM"
},
What should i do now, to retrieve this first video ? i just need to get the link to the video with the video id, (or etag ? )
How the next request should look like ?
If all you want is a URL for the video (at youtube's page), it takes this form:
https://www.youtube.com/watch?v={videoId}
If you're instead looking to embed the video on your page, you could either do so with the embed code, which you can get with this call:
https://www.googleapis.com/youtube/v3/videos?part=player&id={videoId}&key=api key
Or with the iFrame API, which you can read about here:
https://developers.google.com/youtube/iframe_api_reference

Find the youtube channel id for Google+ development or any other reason

Find the channel id for a youtube channel in case you want to subscribe to it or for any other purpose.
Let's say you want to let the users subscribe to the client application's youtube channel by clicking subscribe. The user would have to sign in to Google+ and then run an api request to subscribe. So for this scenario you would need the channel id.
Please note that the new way of doing things is Google+ instead of GData
Go to the following link and replace the username of that channel[foofightersVEVO with the username of that channel]
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=id&maxResults=1&q=foofightersVEVO&type=channel&_h=3&
execute the query and look at the api response:
GET https://www.googleapis.com/youtube/v3/search?part=id&maxResults=1&q=foofightersVEVO&type=channel&key={YOUR_API_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
{
"kind": "youtube#searchListResponse",
"etag": "\"2vd4g3cVsHAtTjJSdUMaBo1PBVE/6Ux-QcH6OQdn3t89j3y5z9RQhv0\"",
"pageInfo": {
"totalResults": 161878,
"resultsPerPage": 1
},
"nextPageToken": "CAEQAA",
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"2vd4g3cVsHAtTjJSdUMaBo1PBVE/Q9-widOQXafayJk0l2DV9nrMYO0\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCGRjJrpD2bmk9Ilq6nq80qg"
}
}
]
}
Note the channelId there. Hope this helps.

Resources