街角_祝福

导航

字典枚举某网站游戏地址

代码:

#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()

posted on 2015-06-13 12:15  街角_祝福  阅读(274)  评论(0编辑  收藏  举报