def __init__(self):
# getting the settings of the project (settings.py)
self.settings = get_project_settings()
# processing input arguments
self.process_args()
# meeting the arguments with the settings
self.change_settings()
# open mongo here just to check if mongod service is running
# if it isn't, might as well not start crawling
if self.args.file == None:
self.open_mongo()
self.dump_collection()
# running the spiders
self.run_crawler()
if self.args.file:
self.sort_file()
else:
if self.args.server == False:
# working with the mongo db
self.sort()
# close mongo
self.close_mongo()
评论列表
文章目录