This repository has been archived on 2025-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
lset/follow-src/source.py

28 lines
971 B
Python
Raw Normal View History

2022-03-11 15:25:33 -07:00
import requests
import time
import json
2022-03-11 23:13:00 -07:00
import os
2022-03-11 15:25:33 -07:00
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']
2022-03-11 23:13:00 -07:00
print("* Follower/sub goal is now running. To add to your stream, add a text source and open the file " + os.path.abspath(WRITE_FILE) + " to display on your stream.")
2022-03-11 15:25:33 -07:00
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)
2022-03-11 23:13:00 -07:00