I am using scrapy 0.20.
I want to use item loader
this is my code:
l = XPathItemLoader(item=MyItemClass(), response=response)
l.add_valu
You need to set an Input or Output processor. TakeFirst would work perfectly in your case.
There are multiple places where you can define it, e.g. in the Item
definition:
from scrapy.item import Item, Field
from scrapy.loader.processors import TakeFirst
class MyItem(Item):
url = Field(output_processor=TakeFirst())
title = Field(output_processor=TakeFirst())
developer = Field(output_processor=TakeFirst())
Or, set a default_output_processor on a XpathItemLoader()
instance:
l.default_output_processor = TakeFirst()