What is the correct way to nest Item data?
For example, I want the output of a product:
{
\'price\': price,
\'title\': title,
\'meta\': {
\'url\'
I think it would be more straightforward to construct the dictionary in the spider. Here are two different ways of doing it, both achieving the same result. The only possible dealbreaker here is that the processors apply on the item['meta'] field, not on the item['meta']['added_on'] and item['meta']['url'] fields.
def parse(self, response):
item = MyItem()
item['meta'] = {'added_on': response.css("a::text").extract()[0]}
item['meta']['url'] = response.xpath("//a/@href").extract()[0]
return item
Is there a specific reason for which you want to construct it that way instead of unpacking the meta field ?