Created
December 29, 2010 15:30
-
-
Save alice1017/758632 to your computer and use it in GitHub Desktop.
ux.nuのAPIを使って引数に指定したURLを省略します
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/python | |
#coding:utf-8 | |
import urllib | |
import sys | |
url="http://ux.nu/api/short?url=" | |
query = url+str(sys.argv[1]) | |
up = urllib.urlopen(query) | |
res = up.read() | |
lists = res.split(":") | |
apidict = {} | |
apidict["data"] = {} | |
apidict["data"]["blacklist"] = lists[2][1:6] | |
apidict["data"]["malware"] = lists[3][1:6] | |
apidict["data"]["safe"] = lists[4][1:5] | |
apidict["data"]["url"] = "http://ux.nu/"+lists[6][11:-8] | |
apidict["new"] = lists[7][1:6] | |
apidict["status_code"] = lists[8][1:4] | |
print "url = " + apidict["data"]["url"] | |
print "malware = " + apidict["data"]["malware"] | |
print "safe = " + apidict["data"]["safe"] | |
print "new = " + apidict["new"] | |
print "status code = " + apidict["status_code"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment