0

Greeting everyone. I was wondering why some channels don't have a items[] while others do, based on the forUsername parameter. Is it something with the channel itself? Thanks in advance.

Was expecting the Object to have a items[], along with the etag, kind etc.

  • [I already answered](https://stackoverflow.com/a/73807243) a similar question. – Benjamin Loison Jan 31 '23 at 21:47
  • Does this answer your question? [How to pull data from YouTube API to a Google Sheet with Channel Links](https://stackoverflow.com/questions/73805356/how-to-pull-data-from-youtube-api-to-a-google-sheet-with-channel-links) – Greenonline Feb 02 '23 at 23:28

1 Answers1

1

It is related to the channel itself.

Example:

If you want to check the channel markiplier, for search this channel using the channels.list endpoint, you have to use the value markiplierGAME.

URL of the request:

https://developers.google.com/youtube/v3/docs/channels/list?hl=es&apix_params={"part":["id,snippet"],"forUsername":"markiplierGAME","maxResults":50}

Try-it here

Result:

{
  "kind": "youtube#channelListResponse",
  "etag": "JzsG_zawoWkLOCBSPYcVSSSLTYg",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 50
  },
  "items": [
    {
      "kind": "youtube#channel",
      "etag": "vre8w7LGy9EkWyA1AHthYN6UXbw",
      "id": "UC7_YxT-KID8kRbqZo7MyscQ",
      "snippet": {
        "title": "Markiplier",
        "description": "Hi, I'm Markiplier. I make videos. \n\nFrom quality content to meme-able garbage, from scary games to full-on interactive movies you'll find it all. You will, actually. I have over 5000 videos so I'm sure there's something you'd like. \n\nMaybe you like horror games, or funny games, or comedy sketches, or animations, or compilations, or reactions, or reviews, or challenges, or cryptic lore, or mind-crippling ennui, or stuff-that-is-guaranteed-to-probably-make-you-cry? Whatever you're into I'm sure there's something for you down in the briny deep of my video page. So why not dive in?\n\nOr don't. Life is yours to choose after all.\n",
        "customUrl": "@markiplier",
        "publishedAt": "2012-05-26T20:30:52Z",
        "thumbnails": {
          "default": {
            "url": "https://yt3.ggpht.com/ytc/AL5GRJVVORzLF5qyUfe9bpQffFSRsNB2OURZrS5237Lrpw=s88-c-k-c0x00ffffff-no-rj",
            "width": 88,
            "height": 88
          },
          "medium": {
            "url": "https://yt3.ggpht.com/ytc/AL5GRJVVORzLF5qyUfe9bpQffFSRsNB2OURZrS5237Lrpw=s240-c-k-c0x00ffffff-no-rj",
            "width": 240,
            "height": 240
          },
          "high": {
            "url": "https://yt3.ggpht.com/ytc/AL5GRJVVORzLF5qyUfe9bpQffFSRsNB2OURZrS5237Lrpw=s800-c-k-c0x00ffffff-no-rj",
            "width": 800,
            "height": 800
          }
        },
        "localized": {
          "title": "Markiplier",
          "description": "Hi, I'm Markiplier. I make videos. \n\nFrom quality content to meme-able garbage, from scary games to full-on interactive movies you'll find it all. You will, actually. I have over 5000 videos so I'm sure there's something you'd like. \n\nMaybe you like horror games, or funny games, or comedy sketches, or animations, or compilations, or reactions, or reviews, or challenges, or cryptic lore, or mind-crippling ennui, or stuff-that-is-guaranteed-to-probably-make-you-cry? Whatever you're into I'm sure there's something for you down in the briny deep of my video page. So why not dive in?\n\nOr don't. Life is yours to choose after all.\n"
        },
        "country": "US"
      }
    }
  ]
}

You clearly see the difference between the title of the channel and the supplied value in the forUsername field.

Unfortunately, I don't know if this feature is documented anywhere and for avoid such complications, I rather user the channel_id - which is an unique value.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33