mirror of
https://github.com/LibraHp/GetQzonehistory.git
synced 2024-12-28 15:09:10 +00:00
修复保存图片时报错的bug
This commit is contained in:
parent
399a285958
commit
646da14b5f
6
main.py
6
main.py
@ -94,6 +94,12 @@ def save_data():
|
||||
if item_pic_link is not None and len(item_pic_link) > 0 and 'http' in item_pic_link:
|
||||
# 保存图片
|
||||
pic_name = re.sub(r'[\\/:*?"<>|]', '_', item_text) + '.jpg'
|
||||
# 去除文件名中的空格
|
||||
pic_name = pic_name.replace(' ', '')
|
||||
|
||||
# 限制文件名长度
|
||||
if len(pic_name) > 40:
|
||||
pic_name = pic_name[:40] + '.jpg'
|
||||
# pic_name = pic_name.split(':')[1] + '.jpg'
|
||||
response = requests.get(item_pic_link)
|
||||
if response.status_code == 200:
|
||||
|
Loading…
Reference in New Issue
Block a user