Get YouTube Channel Information

In this section, we will write a Python script that will extract YouTube channel information using python.

Channel Information:

  • Total Subscribers
  • Total number of videos
  • Total Views

Approach:

  • Here we will use build(), channels(), list(), execute() methods it will give YouTube channel details.
  • Inside list method, pass statistics in part property and in id property pass channelId of YouTube Channel.

Below is the Implementation:

Python3




# Import Module
from googleapiclient.discovery import build
  
# Create YouTube Object
youtube = build('youtube', 'v3'
                developerKey='Enter API key')
  
ch_request = youtube.channels().list(
    part='statistics',
    id='Enter Channel ID')
  
# Channel Information
ch_response = ch_request.execute()
  
sub = ch_response['items'][0]['statistics']['subscriberCount']
vid = ch_response['items'][0]['statistics']['videoCount']
views = ch_response['items'][0]['statistics']['viewCount']
  
print("Total Subscriber:- ", sub)
print("Total Number of Videos:- ", vid)
print("Total Views:- ", views)


Output:

Get information about YouTube Channel using Python

Prerequisite: YouTube API

Google provides a large set of APIs for the developer to choose from. Each and every service provided by Google has an associated API. Being one of them, YouTube Data API is very simple to use provides features like –

  • Search for videos
  • Handle videos like retrieve information about a video, insert a video, delete a video, etc.
  • Handle Subscriptions like lists all the subscriptions, insert or delete a subscription.
  • Retrieve information about comments like replies to a specific comment identified by a parentId etc.

In this article, we are going to perform various YouTube operations in Python using the YouTube API.

Similar Reads

Get YouTube Channel Information

In this section, we will write a Python script that will extract YouTube channel information using python....

Get Description of the individual video from YouTube Playlist

...

Count Number of Playlist of YouTube Channel

In this section, we will learn how to get descriptions of the individual videos from the YouTube Playlist Using Python....

Contact Us