Skip to content

Instantly share code, notes, and snippets.

@showyou
Created February 14, 2010 06:42
Show Gist options
  • Select an option

  • Save showyou/303878 to your computer and use it in GitHub Desktop.

Select an option

Save showyou/303878 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#python analyze_banare.py 自分のid
#で自分のidで調べます
import urllib
import re
import sys
def int2chr(i, i2c):
li = len(i2c)
out = ""
while(1):
a = i % li
out = i2c[a] + out
if i < li : break
i = i / li
return out
def mainLoop():
la = [ chr(i+ord('0')) for i in range(10) ]
lb = [ chr(i+ord('a')) for i in range(26) ]
i2c = la + lb
i = 0
for i in range(1000):
s = int2chr(i,i2c)
banare(s)
def banare(arg):
reg= re.compile("<span class=\"red\">([\w\W]*)</span>")
data = urllib.urlopen("http://neta.spacecom.cc/banare.php?id="+arg).read()
banare = reg.search(data).group(1)
print arg+":"+banare
if __name__ == '__main__':
if len(sys.argv) > 1:
arg = sys.argv[1]
banare(arg)
else: mainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment