Last active
January 4, 2016 04:58
-
-
Save ET-CS/8571663 to your computer and use it in GitHub Desktop.
Python - get YouTube followers using API (v3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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