Home > database >  How do i get certain information about a channel using Youtube APIs "statistics"
How do i get certain information about a channel using Youtube APIs "statistics"

Time:08-21

I am trying to get certain values from different channels using

request = youtube.channels().list(part = "statistics",id = ChannelID)
responseYT = request.execute()
print(responseYT)

The statistics part is showing a lot of information like views, subscriber count etc. but its doing it in an unreadable way. How could I take, for example just the subscriber count and display that?

CodePudding user response:

As responseYT is a Python dict, you can walk through it and as you requested a single channel, you just pick the first item. So it gives:

print(responseYT['items'][0]['statistics']['subscriberCount'])
  • Related