I\'ve created a script using python\'s scrapy module to download and rename movie images from a torrent site and store them in a folder within scrapy project. When I run my scri
Override get_media_requests()
and add the data you need to the request. Then grab that data from the request in file_path()
.
For example:
class YifySpiderPipeline(ImagesPipeline):
def get_media_requests(self, item, info):
# Here we add the whole item, but you can add only a single field too.
return [Request(x, meta={'item': item) for x in item.get(self.images_urls_field, [])]
def file_path(self, request, response=None, info=None):
item = request.meta.get('item')
movie = item['movie']
# Construct the filename.
return image_name