123456789101112131415161718192021222324252627 |
- import logging
- import sys
- from crawler import config
- from crawler.context import Context
- from crawler.strategy import XiaoniangaoHomePageStrategy
- class Main:
- @staticmethod
- def main(argv):
- # Platform Strategy Env
- print("start run crawler...")
- print("Platform = " + argv[0])
- print("Strategy = " + argv[1])
- print("Env = " + argv[2])
- print("Platform = " + config.PLATFORM['xiaoniangao'])
- print("Strategy = " + config.STRATEGY['home_page'])
- print("Env = " + config.ENV['test'])
- # TODO 根据参数判断 具体的策略
- strategy = XiaoniangaoHomePageStrategy()
- context = Context(strategy)
- context.strategy.crawl()
- if __name__ == '__main__':
- Main.main(sys.argv)
|