使用Scrapy保存.svg图像

问题描述

我正在使用Scrapy,我想将网页中的某些.svg图像保存在本地计算机上。这些图片的网址结构为'__。com / svg / 4/8/3 / 1425.svg'(并且是完整的工作网址,包括https)。

我已经在我的items.py文件中定义了该项目:

class ImageItem(scrapy.Item):
image_urls = scrapy.Field()
images = scrapy.Field()

我已在我的设置中添加了以下内容:

ITEM_PIPELINES = {
'scrapy.pipelines.images.ImagesPipeline': 1,}

IMAGES_STORE = '../Data/Silks'
MEDIA_ALLOW_REDIRECTS = True

在主要的解析函数中,我调用:

imageItem = ImageItem()
imageItem['image_urls'] = [url]

yield imageItem

但是它不会保存图像。 Ive遵循了文档,并尝试了许多事情,但始终出现以下错误:

StopIteration: <200 https://www.________.com/svg/4/8/3/1425.svg>

During handling of the above exception,another exception occurred:
......
......
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x1139233b0>

我错过了什么吗?有人可以帮忙吗?我完全陷入了困境。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)