summaryrefslogtreecommitdiff
path: root/YouTubeSubCount.py
blob: 883f014a0a54081ef520ed9726119aa1d8c59560 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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']

#while True:

 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)