pipelines.py 795 B

12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. # Define your item pipelines here
  3. #
  4. # Don't forget to add your pipeline to the ITEM_PIPELINES setting
  5. # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
  6. import os
  7. class YdyspiderPipeline(object):
  8. def __init__(self, stats):
  9. self.__stats = stats
  10. def process_item(self, item, spider):
  11. return item
  12. @classmethod
  13. def from_crawler(cls, crawler):
  14. stats = crawler.stats
  15. return cls(
  16. stats=stats
  17. )
  18. def close_spider(self, spider):
  19. bid_list = self.__stats.get_value('bid_list')
  20. if bid_list is not None:
  21. for bid in bid_list:
  22. command = '/usr/local/php/bin/php /home/www/zhuishuyun_wap/artisan book:afs %s ' % bid
  23. os.system(command)