import json
import requests
#========================================================
#两条横线之间粘贴复制的东西(cookies和header),否则会报错不能运行
#========================================================
photonum = 1234 #照片数量
infolist = []
conn = 0
def getinfo(lastMatchedMoment,realPhotoIndex):
global conn
print('----------------------------'+str(conn)+"-------------------------------")
conn+=1
data = {
'size': '100',
'state': 'active',
'smallPhotoScaleParams': 'image/resize,m_mfit,h_250,w_250',
'originalPhotoScaleParams': 'image/resize,m_mfit,h_1300,w_1300',
'cursor': str(lastMatchedMoment), 'photoIndex': str(realPhotoIndex)
}
response = requests.post('https://cloud.h2os.com/gallery/pc/listNormalPhotos', headers=headers, cookies=cookies,
data=data)
photos = json.loads(response.text).get('photos')
lastMatchedMoment = json.loads(response.text).get('lastMatchedMoment')
realPhotoIndex = json.loads(response.text).get('realPhotoIndex')
for key in photos.keys():
for a in photos.get(key):
id = a.get("id")
real = requests.post('https://cloud.h2os.com/gallery/pc/getRealPhotoUrls', headers=headers, cookies=cookies,data='ids=["'+id+'"]')
infolist.append([json.loads(real.text).get(id),a.get("title")])
if len(infolist)<photonum:
getinfo(lastMatchedMoment, realPhotoIndex)
else:
dowimg()
def dowimg():
con = 0
print(infolist)
for img in infolist:
dir = "img\\" + img[1] # 构造完整文件名称
print("图片名称"+dir)
f = requests.get(img[0])
with open(dir, "wb") as code:
code.write(f.content) # 保存文件
con+=1
print("下载进度",(con/photonum*100),"%")
getinfo(0,0)
print("图片地址获取完毕")
囧囧JOJO
- 粉丝: 26
- 资源: 1
最新资源
- 12Cr1MoV钢主蒸汽管道焊接工艺.pdf
- 12Cr1MoV小径管焊接操作工艺 - .pdf
- 12Cr1MoV异种钢焊接温度场的数值模拟.pdf
- 12Cr2Mo1R珠光体耐热钢的焊接 - .pdf
- 13MnNiMoNbR复合银板焊接裂纹的修复.pdf
- 12MnNiVR钢板焊接裂纹敏感性的试验研究.pdf
- 12MnNiVR钢热处理性能及大热输入焊接韧性.pdf
- 13MnNiMoNbR钢焊接工艺研究.pdf
- 13MnNiMoNbR压力容器高强钢焊接工艺研究.pdf
- 14Cr1MoR新钢种的焊接试验研究.pdf
- 14Cr1MoR-I-0Cr18Ni10Ti复合钢板的焊接 - .pdf
- 13焊接空心球节点的承载能力分析.pdf
- 14CrMoR耐热钢压力容器的埋弧焊焊接工艺应用 - .pdf
- 14CrlMoR+0Crl8Nil0Ti复合钢板焊接.pdf
- 14YTJ108 复合保温钢筋焊接网架混凝土墙(CL建筑体系)构造.pdf
- 15×104_m3双盘浮顶油罐底板焊接工艺.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈