create_panel_parameter.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. '''
  2. Created on 2016年7月28日
  3. @author: uas
  4. '''
  5. from html_parser import kind
  6. #coding=utf-8
  7. #coding=utf-8
  8. '''
  9. Created on 2016年7月20日
  10. @author: uas
  11. '''
  12. from pymongo.mongo_client import MongoClient
  13. from util_common import Constant
  14. import random
  15. class Parserforparameter(object):
  16. def __init__(self):
  17. self.cli=MongoClient(Constant.MONGODB_URL)
  18. self.db=self.cli.spider
  19. def craw(self):
  20. result=self.db.component_panel_0720.find()
  21. for index,row in enumerate(result):
  22. d=dict()
  23. d['url']=result['detail_parameter_url']
  24. d['kind']=kind
  25. d['analysisTask']=Constant.TODO
  26. d['downloadTask']=Constant.TODO
  27. d['cmp_id']=result['cmp_id']
  28. d['random']=random.random()
  29. self.db.panel_parameter_0728.insert_one(d)
  30. d.clear()
  31. print(index)
  32. if __name__=='__main__':
  33. parser=Parserforparameter()
  34. parser.craw()