From 6ce2cc881f22c845524f1cd68ae78b3ab2be5f40 Mon Sep 17 00:00:00 2001 From: injetlee Date: Sat, 28 Jul 2018 11:59:51 +0800 Subject: [PATCH] fix bug --- 爬虫集合/meizitu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/爬虫集合/meizitu.py b/爬虫集合/meizitu.py index e26a83d..4f6932d 100644 --- a/爬虫集合/meizitu.py +++ b/爬虫集合/meizitu.py @@ -40,7 +40,7 @@ def get_pic(link, text): for i in pic_list: pic_link = i.get('src') # 拿到图片的具体 url r = requests.get(pic_link, headers=headers) # 下载图片,之后保存到文件 - with open('pic/{}/{}'.format(text, link.split('/')[-1]), 'wb') as f: + with open('pic/{}/{}'.format(text, pic_link.split('/')[-1]), 'wb') as f: f.write(r.content) time.sleep(1) # 休息一下,不要给网站太大压力,避免被封