# Define your item pipelines here | |
# | |
# Don't forget to add your pipeline to the ITEM_PIPELINES setting | |
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html | |
# useful for handling different item types with a single interface | |
import scrapy | |
from itemadapter import ItemAdapter | |
from scrapy.exceptions import DropItem | |
from scrapy.pipelines.images import ImagesPipeline | |
class DanbooruCrawlerPipeline: | |
def process_item(self, item, spider): | |
return item | |
class PicsDownloadPipeline(ImagesPipeline): | |
def file_path(self, request, response=None, info=None, *, item=None): | |
image_guid = item["image_name"] | |
return f"full/{image_guid}.jpg" | |