scrapy item loader code example
Example 1: scrapy itemloader example
def parse(self, response):
for quote in response.css(".quote"):
loader = ItemLoader(item=QuoteItem(), selector=quote)
loader.add_css("text", ".text")
loader.add_css("by", ".authoor")
loader.add_css("tags", ".tag")
yield loader.load_item()
Example 2: scrapy itemloader example
def parse_item(self, response):
il = ItemLoader(item=ImageItem(), response=response)
il.add_css('image_urls', 'img::attr(src)')
return il.load_item()