标签:baidu with open obj requests int 娱乐明星 print pat com
import requests
import re
url=‘http://tieba.baidu.com/photo/g/bw/picture/list?kw=%E6%9D%A8%E6%B4%8B&alt=jview&rn=200&tid=4748284434&pn=1&ps=1&pe=40&info=1&_=1569421785713‘
res=requests.get(url)
pat=‘"murl":"(.*?)"‘
rst=re.findall(pat,res.text)
for i in rst:
x=re.findall(‘(http://+[\S]+?.jpg)‘,i)
# print(x)
res=requests.get(x[0])
y=re.findall(‘[a-zA-Z0-9]+?.jpg‘,x[0])[0]
# print(y)
with open(‘job/‘+y,‘wb‘) as pic_object:
pic_object.write(res.content)
标签:baidu with open obj requests int 娱乐明星 print pat com
原文地址:https://www.cnblogs.com/tiankong-blue/p/11588245.html