title: scrapy custom output processor
body: <p>I'm using the scrapy framework for a web scraping project but I can't seem to figure out how to get a custom output processor to work.</p>
  
  <p>I have an item class like so:</p>
  
  <pre><code>class Item(scrapy.Item)
  
      ad_type = scrapy.Field()
  </code></pre>
  
  <p>then my parse function looks something like this. I have 2 scraped strings which I am adding to the ad_type. I want my output processor function to assign tags based on what is scraped from these 2 xpaths.</p>
  
  <pre><code>def parse(self, response):
  
      l = ItemLoader(item=Item(), selector=listing)
      l.add_xpath('ad_type', '(.//div/@class)[1]')
      l.add_xpath('ad_type', '(.//div[contains(@class, "brand")]/@class)[1]')
      yield l.load_item()
  </code></pre>
  
  <p>How do I get my output processor function to access the 2 xpath scraped strings that I have added to ad_type? The scrapy docs give this example but I can't get it to work.</p>
  
  <pre><code>def lowercase_processor(self, values):
      for v in values:
          yield v.lower()
  
  class MyItemLoader(ItemLoader):
      name_in = lowercase_processor
  </code></pre>