Reputation: 299
I want to add a field to scrapy.Item so that it's an array:
class MyItem(scrapy.Item): field1 = scrapy.Field() field2 = scrapy.Field() field3_array = ???
How can I do that?
Upvotes: 19
Views: 13207
Reputation: 8154
You just create a filed
field3_array = scrapy.Field()
But while parsing the scraped items do like this
items['field3_array'] = [] items['field3_array'][0] ='one' items['field3_array'][1] ='two'
in this way you can achieve this.
Have a look
Upvotes: 27