def gen_media_requests(self, item, info):
for image_url in item["cimage_urls"]:
yield scrapy.Request(image_url, meta={"item": item})
def file_path(self, request, response=None, info=None):
item = request.meta.get("item", "test")
name = item["name"]
image_guid = request.url.split("/")[-1]
return "full/%s/%s" % (name, image_guid)
I put item in meta and passed it to file_path (), according to the above code, but debug found that in file_path (), meta is empty. I need to store pictures in a folder according to a field in item. If the above code can not be easily modified to achieve the effect, is there any other way?