From 45b51743ad0bbe3aca2787966d2cbe1285fc49db Mon Sep 17 00:00:00 2001 From: dee-oh-double-gee Date: Fri, 24 Feb 2017 21:40:56 -0700 Subject: Create YouTubeSubCount.py --- YouTubeSubCount.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 YouTubeSubCount.py (limited to 'YouTubeSubCount.py') diff --git a/YouTubeSubCount.py b/YouTubeSubCount.py new file mode 100644 index 0000000..95cfd6d --- /dev/null +++ b/YouTubeSubCount.py @@ -0,0 +1,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) + -- cgit v1.2.3