Skip to content

Instantly share code, notes, and snippets.

@fredycoding
Last active June 8, 2022 13:32
Show Gist options
  • Save fredycoding/8655a5f909906f0a4718639953f86c44 to your computer and use it in GitHub Desktop.
Save fredycoding/8655a5f909906f0a4718639953f86c44 to your computer and use it in GitHub Desktop.
API de Youtube para obtener suscriptores de un canal

Obtener suscriptores de YOUTUBE en PYTHON

Hay que obtener la api key de YOUTUBE ANALYTICS

Solo funciona para obtener los datos de un canal propio!
#Para que funcione hay que habilitar la api key de youtube data api
from googleapiclient.discovery import build
 
 
youTubeApiKey="AIzaSyBbP8D******************"
youtube= build("youtube","v3",developerKey=youTubeApiKey) #Aca usamos YouTube Data API v3
channelId = "UC6V***************"
 
#Calling Data from API
 
statdata=youtube.channels().list(part="statistics",id=channelId).execute()
stats=statdata["items"][0]["statistics"]
print("Suscriptores: ", stats['subscriberCount'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment