-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsubgap-cli.py
More file actions
22 lines (18 loc) · 751 Bytes
/
Copy pathsubgap-cli.py
File metadata and controls
22 lines (18 loc) · 751 Bytes
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 sys
import os
from sty import fg
from googleapiclient.discovery import build
key = open(os.path.join(sys.path[0], './key.txt')).read().strip()
service = build('youtube', 'v3', developerKey=key)
pewdiepiesubs = service.channels().list(
part='statistics',
id='UC-lHJZR3Gqxm24_Vd_AJ5Yw'
).execute()['items'][0]['statistics']['subscriberCount']
tseriessubs = service.channels().list(
part='statistics',
id='UCq-Fj5jknLsUf-MWSy4_brA'
).execute()['items'][0]['statistics']['subscriberCount']
print(fg.magenta + "PewDiePie is at " + str(pewdiepiesubs) + " subs")
print(fg.red + "T-Series is at " + str(tseriessubs) + " subs")
print(fg.white + "Sub gap is " + str(int(pewdiepiesubs) - int(tseriessubs)) + " subs")