Skip to content

Instantly share code, notes, and snippets.

@mcgrew
Created October 13, 2018 21:56
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 mcgrew/1c58622c5948a9a24075780dc794ea76 to your computer and use it in GitHub Desktop.
Save mcgrew/1c58622c5948a9a24075780dc794ea76 to your computer and use it in GitHub Desktop.
Twitch emote lookup by code
#!/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