Created
October 13, 2018 21:56
-
-
Save mcgrew/1c58622c5948a9a24075780dc794ea76 to your computer and use it in GitHub Desktop.
Twitch emote lookup by code
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
#!/usr/bin/env python3 | |
from json import loads | |
from sys import argv, exit | |
from urllib.request import Request, urlopen | |
if len(argv) < 2: | |
print("Usage: %s <emote_name>" % argv[0]) | |
exit(-1) | |
request = Request('https://twitchemotes.com/api_cache/v3/images.json') | |
result = urlopen(request) | |
emotes = loads(result.read()) | |
for emote in emotes: | |
if emotes[emote]['code'] == argv[1]: | |
print (emotes[emote]) | |
exit(0) | |
print ("Emote '%s' not found" % argv[1]) | |
exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment