We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果笔记中有通过连接引入的图片,并且连接无法访问,那么下载程序会报错,后续图片下载会卡住
在export-image.py中修改
# ... (前面的代码保持不变) for img_link in img_links: # ... (前面的代码保持不变) if download_image: download_folder = os.path.join(image_folder, years) if not os.path.exists(download_folder): os.mkdir(download_folder) img_url = urlunparse(parsed_url._replace(fragment="")) # 添加异常处理 try: response = requests.get(img_url, timeout=10) # 设置超时时间 response.raise_for_status() # 检查请求是否成功 with open(os.path.join(download_folder, img_filename), "wb") as img_file: img_file.write(response.content) print(f"Downloaded: {img_filename}") except requests.exceptions.Timeout: print(f"[Warning]: Timeout while downloading {img_url}. Skipping.") continue except requests.exceptions.RequestException as e: print(f"[Error]: An error occurred while downloading {img_url}: {e}. Skipping.") continue # ... (后面的代码保持不变)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
如果笔记中有通过连接引入的图片,并且连接无法访问,那么下载程序会报错,后续图片下载会卡住
在export-image.py中修改
The text was updated successfully, but these errors were encountered: