Youtube API - No Channel Name

I am trying to get the name of a Youtube channel using the Youtube data API, but I am getting an empty element. I have a channel in my Youtube account, so it should return it.

These are the query properties that I entered -

part:'contentDetails', forUsername: 'Seong+Lee',

to get the next answer on their interactive page.

200 OK
- SHOW HEADERS -
{
 "kind": "youtube#channelListResponse",
 "etag": "\"fpJ9onbY0Rl_LqYLG6rOCJ9h9N8/C3QZ-VsykvkpW2zCm7VjGBCayqc\"",
 "pageInfo": {
  "totalResults": 0,
  "resultsPerPage": 5
 },
 "items": [
 ]
}

In my application, I get the same answer, so I decided there was no problem with my request code. Why can't I get the channel name?

+4
source share
2 answers

You can get contentDetailsusing your channel id.

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCwy6X3JB24VTsDFqMwdO5Jg&key={YOUR_API_KEY}

Your username is clearly invalid.

+4
source

, URL-, forUsername. URL /user/{channelname}. , , .

, snippet contentDetails.

https://www.googleapis.com/youtube/v3/channels?part=snippet&id=UCwy6X3JB24VTsDFqMwdO5Jg&key={YOUR_API_KEY}

snippet.title

{
    kind: "youtube#channelListResponse",
    etag: ""0KG1mRN7bm3nResDPKHQZpg5-do/L4uU6pmZJ1wQKdGUwnnigYpSEVo"",
    pageInfo: {
        totalResults: 1,
        resultsPerPage: 1
    },
    items: [
    {
        kind: "youtube#channel",
        etag: ""0KG1mRN7bm3nResDPKHQZpg5-do/GKVRHf7CLp-mUGFTR_3wbc5Lq-k"",
        id: "UCwy6X3JB24VTsDFqMwdO5Jg",
        snippet: {
            title: "Seong Lee",

...
+4

Source: https://habr.com/ru/post/1612869/


All Articles