Skip to content

Instantly share code, notes, and snippets.

@marksie1988
Created January 28, 2021 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marksie1988/88ee17d79e43c77ea0a367fe2ee97232 to your computer and use it in GitHub Desktop.
Save marksie1988/88ee17d79e43c77ea0a367fe2ee97232 to your computer and use it in GitHub Desktop.
Uses python to open a webbrowser when a streamer comes online
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