It is weird I know, but there is only one field class and it is the Field() type. You can pass is it a list and it will get a list. I had the same problem before a while ago, but somewhere on stackoverflow I read you could just pass it a list and it will work. I tried it and it worked for me.
On Tuesday, September 20, 2016 at 3:04:13 AM UTC-7, Alex wrote: > > Hello, > > I would like to ask for advice in representing the model of the site I'm > crawling. Each page represents a movie that has multiple reviews and I was > thinking that it would make sense for the reviews to be stored in a list. > Here is an example > > ``` > class MovieItem(Item): > text = Field() > timestamp = Field() > reviews = [ ] # TODO this will be a list of MovieReviewItem > > > class MovieReviewItem(Item): > text = Field() > author = Field() > timestamp = Field() > ``` > > Thus, the MovieItem object will contain all the associated information and > hopefully, when dumped into a JSON - the structure will be preserved. > > > In an earlier post on the list, someone asked a similar question and the > suggestion was to use `MultiValuedField`. However, that was back in 2009 > and right now there's no reference to it anywhere in the source of Scrapy > (except in documentation, where it is marked as obsolete). > > 1. What is the recommended way of handling such a situation? > 2. Would it then be correctly serialized to JSON? > -- You received this message because you are subscribed to the Google Groups "scrapy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/d/optout.
