Last active
December 29, 2015 14:19
-
-
Save emilyst/7683017 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/local/bin/python3 | |
# save to: ~/Library/Application\ Scripts/com.codeux.irc.textual/gif.py | |
# use as '/gif searchterm' | |
# prints a link to the first GIF to match the term to the current window | |
import sys | |
import random | |
search_term = sys.argv[2] | |
from giphypop import Giphy | |
g = Giphy() | |
results = [ x for x in g.search(search_term) ] | |
chosen = random.choice(results) | |
print("Random GIF tagged with '" + search_term + "': " + chosen.media_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment