运行scrapy保存图片,报错ValueError: Missing scheme in request url: h
查阅相关资料,了解到使用ImagesPipeline传入的url地址必须是一个list,而我写的是一个字符串,所以报错,所以需要修改一下传入的url格式就行了
def parse_detail(self, response): # print(response) item = JobBoleItem() # note:把字符创修改为列表即可 item['front_image_url'] = [response.meta.get('front_image_url', '')] # 文章封面图 item["title"] = response.css('.entry-header h1::text').extract_first() content_list = response.css('.entry p::text').extract() item["content"] = ''.join(content_list) item["tags"] = ''.join(response.css('.post-adds span::text').extract()).strip() # print(title,content,tags) yield item