Skip to content

Instantly share code, notes, and snippets.

@ET-CS
Last active January 4, 2016 04:58
Show Gist options
  • Save ET-CS/8571663 to your computer and use it in GitHub Desktop.
Save ET-CS/8571663 to your computer and use it in GitHub Desktop.
Python - get YouTube followers using API (v3)
import requests
import simplejson as json
# UPDATED to use API (v3)
def get_youtube_followers():
url = "https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=[UserName]&key=[API-Key]"
j=json.loads((requests.get(url, timeout=5)).text)
return j['items'][0]['statistics']['subscriberCount']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment