summaryrefslogtreecommitdiff
path: root/YouTubeSubCount.py
blob: 95cfd6d7ff9e0bb750474cf3d266c2d55681d08d (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=YOUTUBE_IT&key=YOUTUBE_DATA_API_V3')
 j = r.json()

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

#while True:

 time.sleep(60)
 os.system('clear')
 print "Beau Knows Tech... Stuff Channel Stats:"
 print "Total number of subscribers: %s" % (subs)
 print "Total number of views: %s" % (views)