summaryrefslogtreecommitdiff
path: root/YouTubeSubCount.py
blob: eabe6cf36fd8248d85d392ee16233aa260aa2557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python
import requests
import json
import time
import os

while True:

 r = requests.get('https://www.googleapis.com/youtube/v3/channels?part=statistics&id=CHANNEL_ID&key=YOUTUBE_DATA_API_V3')
 j = r.json()

 subs = j['items'][0]['statistics']['subscriberCount']
 views = j['items'][0]['statistics']['viewCount']


 time.sleep(5)
 os.system('clear')
 print "YOUR CHANNEL Channel Stats:"
 print "Total number of subscribers: %s" % (subs)
 print "Total number of views: %s" % (views)