Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
How do i get a subscriber count from youtube api by channel name

I am trying to use youtube's api to get the subscriber count of a channel by it's channel name using node.js. How do i do that?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use the official YouTube API channels.list method to get statistics like: subscriberCount, videoCount and viewCount.

Get statistics from a YouTube channel                                                                                 Run in Fusebit
const youtube = googleClient.youtube('v3');
const channelName = 'GoogleDevelopers';
const channelsResponse = await youtube.channels.list({
  part: 'id,statistics',
  forUsername: channelName,
});

if (channelsResponse.data.items && channelsResponse.data.items.length) {
  const { statistics: { subscriberCount, videoCount, viewCount } } = channelsResponse.data.items[0];
  console.log(`The channel ${channelName} has 🧑🏾‍🤝‍🧑🏾 ${subscriberCount} subscribers, 🎬 ${videoCount} videos and 👀 ${viewCount} views.`);
} else {
  console.log = `Channel not found: ${channelName}`;
}

[Update]

Based on the comments, here is an example of how to search for a channel based on a search term, then you will use the channel id to get the statistics, from the previous code, instead of sending forUserName parameter you will send id See search API docs here

  const channelsResponse = await youtube.search.list({
    part: 'snippet',
    q: searchTerm,
    maxResults: 10,
    type: 'channel',
    order: 'viewCount' // show more popular first
  });

This is the response object returned by each item from the search

{
  "kind": "youtube#searchResult",
  "etag": etag,
  "id": {
    "kind": string,
    "videoId": string,
    "channelId": string,
    "playlistId": string
  },
  "snippet": {
    "publishedAt": datetime,
    "channelId": string,
    "title": string,
    "description": string,
    "thumbnails": {
      (key): {
        "url": string,
        "width": unsigned integer,
        "height": unsigned integer
      }
    },
    "channelTitle": string,
    "liveBroadcastContent": string
  }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!