Created
January 28, 2021 09:41
-
-
Save marksie1988/88ee17d79e43c77ea0a367fe2ee97232 to your computer and use it in GitHub Desktop.
Uses python to open a webbrowser when a streamer comes online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webbrowser | |
from twitchAPI.twitch import Twitch | |
CHANNEL_NAME = "<change to channel name>" | |
# visit https://dev.twitch.tv/console/apps create an app | |
# redirect url: http://localhost:17563 | |
twitch = Twitch('<app_key>', '<app_Secret>') | |
twitch.authenticate_app([]) | |
response = twitch.get_streams(user_login=[CHANNEL_NAME]) | |
if not response['data']: | |
exit | |
else: | |
webbrowser.open(f'http://twitch.tv/{CHANNEL_NAME}', new=2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment