And there's Item Loaders, of course http://doc.scrapy.org/en/latest/topics/loaders.html
Em quarta-feira, 22 de janeiro de 2014 15h43min46s UTC-2, Rolando Espinoza La fuente escreveu: > > To add to Bill's answer: > > - It helps you avoid to make typos in the field name. > - It allows you to specify per-field input/output processors, although you > can use a dict class in the item loaders too. > - It allows you to reuse base items to create more item classes. Also, as > your project grows, it helps you to document what the fields are for. > > And yes, it's annoying when you just want to scrape a few fields from a > few pages but you will appreciate having an Item class when your project > gets larger and you have a lot of spiders. > > If you are lazy, like myself, you can use this helper: > https://github.com/darkrho/scrapy-boilerplate/blob/master/scrapy_boilerplate.py#L218 > > And write items like this: > > BaseItem = NewItem("title body url") > QuestionItem = NewItem("tags status", base_cls=BaseItem) > AnswerItem = NewItem("user", base_cls=BaseItem) > > > > On Wed, Jan 22, 2014 at 9:55 AM, Bill Ebeling <[email protected]<javascript:> > > wrote: > >> >> Off the top of my head, Items are objects, so you can extend them to add >> methods and the like. >> >> Probably useful under the hood, too. >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/scrapy-users. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- 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 http://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/groups/opt_out.
