EDIT:
This is not duplicate of older version of scrapy . Scrapy has changed recently in years and current version is 0.24
Scrapy has evolved dramatically over the few years of development. Most of the answer of stackoverflow regarding scrapy are outdated.
I am using scrapy 0.24.4 and want to download images in a separate manner for each link. Right now, using scrapy documentation, I am able to download image but they only reside in only one folder.
I am using the below code, so it gets saved in separate folder as per each url, but unable to achieve it. This code don't even run , it resides in pipelines.py . Only the default behavior of images pipeline gets executed i.e it downloads every url in item['image_urls'] .
pipelines.py
import scrapy
from scrapy.contrib.pipeline.images import ImagesPipeline
from scrapy.exceptions import DropItem
import urlparse
import urllib
class RecursiveScrapPipeline(object):
"""Custom Image to save in Structured folder """
def process_item(self, item, spider):
#item currently is image name
image_guid = item
return "%s/full/%s.jpg"% (id,image_guid)
#this should work , exactly as per documentation
def get_media_requests(self, item, info):
for image_url in item['image_urls']:
yield scrapy.Request(image_url,meta={'id':item['Property_name']})
Am I on correct track? What could possibly be the solution ?