aboutsummaryrefslogtreecommitdiff
path: root/follow-src/source.py
blob: b17b9ac2bfad3f403dcc6c7355e16bbf5df032d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import requests
import time
import json

with open('settings.json') as f:
  settings = json.load(f)

FOLLOWER_GOAL = settings['follower_goal']
SUB_GOAL = settings['sub_goal']
WRITE_FILE = settings['write_file']
USER = settings['username']
UPDATE = settings['seconds_interval']

print("Running!")
while(True):
    followers = open(WRITE_FILE, 'w')
    url_follows = "https://api.crunchprank.net/twitch/followcount/" + USER
    read_follows = requests.get(url_follows)
    url_subs = "https://decapi.me/twitch/subcount/" + USER
    read_subs = requests.get(url_subs)
    #if int(read_follows.text) > followerGoal:
    #    followerGoal += 50
    print(f"Subs: {read_subs.text}/{SUB_GOAL}\nFollower goal: {read_follows.text}/{FOLLOWER_GOAL}\n", end='', file=followers)
    followers.close()
    time.sleep(UPDATE)