1

I'm trying to get the YouTube channel id by its username, but in the end I get nothing. The username and API key are correct. What could be the problem?

HTTP Request: https://www.googleapis.com/youtube/v3/channels?part=id&forUsername=fugu1449&key=apikey

Response:

{
    "kind": "youtube#channelListResponse",
    "etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
    "pageInfo": {
        "totalResults": 0,
        "resultsPerPage": 5
    }
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Nicholas
  • 11
  • 1

2 Answers2

1

YouTube channel various ids

YouTube Data API v3 partial support with these ids

YouTube Data API v3 mostly supports channel ids (the ones starting with UC) however it's possible with it to retrieve channel ids from channel user/ ids thanks to Channels: list endpoint with forUsername filter.

However YouTube Data API v3 doesn't provide the ability to retrieve channel ids from c/ ids and handles.

YouTube operational API completes this support

Nevertheless you can retrieve channel ids from c/ ids and handles thanks to my open-source YouTube operational API. Indeed by fetching respectively https://yt.lemnoslife.com/channels?cId=C_ID and https://yt.lemnoslife.com/channels?handle=HANDLE you'll get the associated channel id.

For instance with hugodecrypte and @redcross you would respectively obtain:

{
    "kind": "youtube#channelListResponse",
    "etag": "NotImplemented",
    "items": [
        {
            "kind": "youtube#channel",
            "etag": "NotImplemented",
            "id": "UCAcAnMF0OrCtUep3Y4M-ZPw"
        }
    ]
}
{
    "kind": "youtube#channelListResponse",
    "etag": "NotImplemented",
    "items": [
        {
            "kind": "youtube#channel",
            "etag": "NotImplemented",
            "id": "UC0aMPje3ZACnQPKM_qzY0vw"
        }
    ]
}
Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
0

Not like that: https://www.googleapis.com/youtube/v3/channels?part=id&forUsername=fugu1449&key=apikey You need to specify snippet after part. It has to be like this:

https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername=fugu1449&key=apiKey

and I should point out: YouTube Data API v3 still doesn't support Handles. So we continue to use search logic for identifier to find the user id. Example:

https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&q=@handle&key=apiKey

or you can get it by making a direct inquiry from this address. YouTube Channel ID Finder, Find youtube channel information, statistics and Channel ID: https://ytlarge.com/youtube/channel-id-finder/ It uses the same logic here.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
PLuToNiuM
  • 53
  • 10