这就是我在Scrapy 0.10中解决问题的方式。检查FSImagesStoreChangeableDirectory的persist_image方法。下载图像的文件名是密钥
class FSImagesStoreChangeableDirectory(FSImagesStore): def persist_image(self, key, image, buf, info,append_path): absolute_path = self._get_filesystem_path(append_path+'/'+key) self._mkdir(os.path.dirname(absolute_path), info) image.save(absolute_path)class ProjectPipeline(ImagesPipeline): def __init__(self): super(ImagesPipeline, self).__init__() store_uri = settings.IMAGES_STORE if not store_uri: raise NotConfigured self.store = FSImagesStoreChangeableDirectory(store_uri)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)