type : 'POST',
url : '/index.php/request/new_data2/' + times + '/'+locinfo[domn][0],
dataType : 'json',
# -*- coding: utf-8 -*- import urllib2 as url import json import sys import os from datetime import *
def create_html(alllist,name):
html_head='<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>duilu</title><body>'
html_end="</body></html>"
f=open("%s.html"%(name),"w")
f.write(html_head)
for x in range(len(alllist)):
f.write('<div><img src="%s/%s.gif"/>'%(name,str(x)))
f.write('<p>%s</p></div>'%(alllist[x]['t'].encode('utf-8')))
f.write(html_end)
f.close()
def download(list,dirname,index=0):
os.chdir(dirname)
for dict in list:
imgurl=dict['i']
text= dict['t']
print index
print imgurl
print text
res=url.urlopen(imgurl)
img_type=".gif"
content_type=res.headers["content-type"]
if content_type=="image/jpeg":
type=".jgp"
filepath="%s"%(str(index)+img_type)
f=open(filepath,"wb")
f.write(res.read())
f.close()
res.close()
index+=1
os.chdir("../")
def start(type,lenght):
lenght=int(lenght)
now=datetime.now()
now=now.strftime("%m-%d %H.%M.%S")
os.mkdir(type+now)
alllist=[]
for x in range(0,lenght):
list=get_json(x,type)
alllist.extend(list)
create_html(alllist,type+now)
download(alllist,type+now)
print "rnrn==============OK==============rnrn"
while(True):
print "输入tws(太猥琐) tr(太热) tgx(太搞笑) tml(太萌了) tht(太好听 tyy(太养眼) 之一rnexit:退出"
type=raw_input()
all_type=["tgx","tws","tyy","tr","tml","tht"]
if type in all_type:
print "键入下载页数:"
lenght=raw_input()
start(type,lenght)
elif type=="exit":
break
else:
print "rn输入有误rn"
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有