items.py 791 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. # Define here the models for your scraped items
  3. #
  4. # See documentation in:
  5. # http://doc.scrapy.org/en/latest/topics/items.html
  6. import scrapy
  7. from scrapy.contrib.loader import ItemLoader
  8. from scrapy.contrib.loader.processor import MapCompose, TakeFirst, Join
  9. class MeizituItem(scrapy.Item):
  10. url = scrapy.Field()
  11. name = scrapy.Field()
  12. tags = scrapy.Field()
  13. image_urls = scrapy.Field()
  14. images = scrapy.Field()
  15. class CoserItem(scrapy.Item):
  16. url = scrapy.Field()
  17. name = scrapy.Field()
  18. info = scrapy.Field()
  19. image_urls = scrapy.Field()
  20. images = scrapy.Field()
  21. class MyItemLoader(ItemLoader):
  22. default_input_processor = MapCompose(lambda s: s.strip())
  23. default_output_processor = TakeFirst()
  24. description_out = Join()