Created
July 14, 2015 21:41
-
-
Save Red5d/95e6009708f60d2a1b40 to your computer and use it in GitHub Desktop.
CLI python tool for using the http://memegen.link/ meme generator service.
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 python | |
# Author: Red5d | |
# Client tool for the http://memegen.link/ service. | |
# Run with no parameters for help. | |
import json, sys, urllib | |
if len(sys.argv) < 2: | |
r = urllib.urlopen("http://memegen.link/templates") | |
templates = json.loads(r.readlines()[0]) | |
print "Usage: memegen <template> <toptext> <bottomtext>" | |
print "Templates:" | |
for item in templates.keys(): | |
print "\t"+templates[item].split("templates/")[1].ljust(20)+item | |
else: | |
r = urllib.urlopen("http://memegen.link/"+sys.argv[1]+"/"+sys.argv[2].replace(" ", "-")+"/"+sys.argv[3].replace(" ", "-")) | |
print json.loads(r.readlines()[0])['direct']['masked'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment