DDR爱好者之家 Design By 杰米
代码如下:
复制代码 代码如下:
import sys, urllib
import datetime,time
def getDate():
strday=datetime.datetime.now().__str__()
strday=strday.split()[0]
return strday
#url = "http://www.kingnic.com/list/2009-06-16.txt"
def getUrl(dateStr=None):
baseUrl ="http://www.kingnic.com/list/"
if dateStr:
return baseUrl+dateStr+".txt"
thisDate = getDate();
if not thisDate:
print "Error Date!"
return None;
url = baseUrl+thisDate+".txt"
return url
def getSource(url):
source = urllib.urlopen(url).read()
return source
def save(source,filename="domains.txt"):
fp = open(filename,"w")
fp.write(source)
fp.close()
return True;
def loadList(fileName="domains.txt"):
fp = open("domains.txt","r")
source = fp.readlines()
fp.close()
return source;
def getPrefix(domain):
return domain.split('.')[0]
def getPostfix(domain):
return domain.split('.')[1]
def hasMidLine(domain):
if '-' in domain:
return True
else:
return False
def parser(domains):
max =4
min =0
keyword =('sky','see','job')
result=[]
len_num =0;
mid_line_num =0;
for domain in domains:
prefix = getPrefix(domain)
postfix = getPostfix(domain)
domainlen = len(prefix)
if (domainlen < min) or (domainlen > max):
len_num +=1
continue
if hasMidLine(prefix):
mid_line_num +=1
continue
result.append(domain)
print " log : \n"
print "all: \t",len(domains)
print "len not in [%s,%s] \t: %s"%(max,min,len_num)
print "contain '-' :\t",mid_line_num
print "remain:\t",len(result)
return result;
if __name__ == "__main__":
url = getUrl()
source = getSource(url)
save(source)
domains =loadList()
result = parser(domains)
save("".join(result),"result.txt")
print("\n\n\nfinished!!")
输出文件:
domains.txt : kingnic.com 据当天释放的 域名;
result.txt : 符合过滤条件的域名;
log输出:
复制代码 代码如下:
all: 55500
len not in [4,0] : 55019
contain '-' : 32
remain: 449
finished!!
对 后缀、长度和有无“-”过滤,过滤条件有点少,其它以后如有需要再加。
复制代码 代码如下:
import sys, urllib
import datetime,time
def getDate():
strday=datetime.datetime.now().__str__()
strday=strday.split()[0]
return strday
#url = "http://www.kingnic.com/list/2009-06-16.txt"
def getUrl(dateStr=None):
baseUrl ="http://www.kingnic.com/list/"
if dateStr:
return baseUrl+dateStr+".txt"
thisDate = getDate();
if not thisDate:
print "Error Date!"
return None;
url = baseUrl+thisDate+".txt"
return url
def getSource(url):
source = urllib.urlopen(url).read()
return source
def save(source,filename="domains.txt"):
fp = open(filename,"w")
fp.write(source)
fp.close()
return True;
def loadList(fileName="domains.txt"):
fp = open("domains.txt","r")
source = fp.readlines()
fp.close()
return source;
def getPrefix(domain):
return domain.split('.')[0]
def getPostfix(domain):
return domain.split('.')[1]
def hasMidLine(domain):
if '-' in domain:
return True
else:
return False
def parser(domains):
max =4
min =0
keyword =('sky','see','job')
result=[]
len_num =0;
mid_line_num =0;
for domain in domains:
prefix = getPrefix(domain)
postfix = getPostfix(domain)
domainlen = len(prefix)
if (domainlen < min) or (domainlen > max):
len_num +=1
continue
if hasMidLine(prefix):
mid_line_num +=1
continue
result.append(domain)
print " log : \n"
print "all: \t",len(domains)
print "len not in [%s,%s] \t: %s"%(max,min,len_num)
print "contain '-' :\t",mid_line_num
print "remain:\t",len(result)
return result;
if __name__ == "__main__":
url = getUrl()
source = getSource(url)
save(source)
domains =loadList()
result = parser(domains)
save("".join(result),"result.txt")
print("\n\n\nfinished!!")
输出文件:
domains.txt : kingnic.com 据当天释放的 域名;
result.txt : 符合过滤条件的域名;
log输出:
复制代码 代码如下:
all: 55500
len not in [4,0] : 55019
contain '-' : 32
remain: 449
finished!!
对 后缀、长度和有无“-”过滤,过滤条件有点少,其它以后如有需要再加。
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2025年01月06日
2025年01月06日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]