字典枚举某网站游戏地址


  • http://cafebabe.cc/nazo/basic/cache.html
  • http://cafebabe.cc/nazo/medium/champion.html
  • http://cafebabe.cc/nazo/basic/cherry.html
  • http://cafebabe.cc/nazo/click.html
  • http://cafebabe.cc/nazo/medium/delete.html
  • http://cafebabe.cc/nazo/medium/dizzy.html
  • http://cafebabe.cc/nazo/medium/for.html
  • http://cafebabe.cc/nazo/medium/forty.html
  • http://cafebabe.cc/nazo/basic/fractal.html
  • http://cafebabe.cc/nazo/basic/index.html
  • http://cafebabe.cc/nazo/index.html
  • http://cafebabe.cc/nazo/basic/key.html
  • http://cafebabe.cc/nazo/medium/kick.html
  • http://cafebabe.cc/nazo/medium/level.html
  • http://cafebabe.cc/nazo/medium/lie.html
  • http://cafebabe.cc/nazo/basic/month.html
  • http://cafebabe.cc/nazo/basic/office.html
  • http://cafebabe.cc/nazo/medium/portal.html
  • http://cafebabe.cc/nazo/basic/random.html
  • http://cafebabe.cc/nazo/medium/reed.html
  • http://cafebabe.cc/nazo/basic/shadow.html
  • http://cafebabe.cc/nazo/medium/slumber.html
  • http://cafebabe.cc/nazo/basic/solve.html
  • http://cafebabe.cc/nazo/basic/sonic.html
  • http://cafebabe.cc/nazo/medium/spring.html
  • http://cafebabe.cc/nazo/medium/suffix.html
  • http://cafebabe.cc/nazo/medium/template.html
  • http://cafebabe.cc/nazo/medium/thumb.html
  • http://cafebabe.cc/nazo/medium/tilt.html
  • http://cafebabe.cc/nazo/medium/tyrant.html
  • http://cafebabe.cc/nazo/java.html

代码:

#coding=utf8
import urllib2

word_file = open("words.txt","r")
url_file = open("nazo.html","a")
while True:
    line = word_file.readline()
    if not line:
        break
    line = line.strip()
    
    url_list = ['http://cafebabe.cc/nazo/basic/','http://cafebabe.cc/nazo/medium/','http://cafebabe.cc/nazo/']
    
    for url in url_list:
        try:
            url = url + line + '.html'
            page = urllib2.urlopen(url)
            print 'success -> ', url
            url_file.write(url+"\n")
        except Exception,ex:
            print '\rfailed -> ',line,
            pass
word_file.close()
url_file.close()