for img_link in img_link_list:
filename = '{}{}_{}.jpg'.format(directory, word, self.i)
self.save_image(img_link,filename)
self.i += 1
# 每页只能下载60张图片,这里可以直接跳出,或者按需要的数量更改
if self.i == 180:
print(self.i)
return
# 也可以改成翻页下载的形式:
# self.url = 'https://image.baidu.com/search/flip?tn=baiduimage&ie=utf-8&word={}{}'
# 格式化地址:url = self.url.format(word_parse,'&pn=40') #这里的pn=20
1