百度抓取图片出错?
# coding=utf-8
import re
import urllib2
req = urllib2.urlopen('https://image.baidu.com/search/index?tn=baiduimage&ipn=r&ct=201326592&cl=2&lm=-1&st=-1&fm=result&fr=&sf=1&fmq=1489897112965_R&pv=&ic=0&nc=1&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&ie=utf-8&word=跑车')
buf = req.read()
#print buf
web = re.findall(r'''https://.+?\.jpg''',str(buf))
n=1
for i in web:
freq = urllib2.urlopen(i)
fbuf = freq.read()
f = open(str(n)+'.jpg', 'w')
f.write(fbuf)
n += 1