123456789101112131415161718192021222324252627 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2022/05/23 14:33:19
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc : main
- '''
- import crawl_xiaohua
- import argparse
- parser = argparse.ArgumentParser(description='crawl_xiaohua')
- parser.add_argument('command', type=str, help='server, run ?')
- parser.add_argument('--config', type=str, help='config file')
- parser.add_argument('--extractor', type=str, help='extractor name')
- parser.add_argument('--cmd', type=str, help='shell command')
- if __name__ == '__main__':
- args = parser.parse_args()
- if args.command == 'server':
- crawl_xiaohua.server(args.config)
- print('server')
- elif args.command == 'run':
- crawl_xiaohua.run(args.extractor, args.cmd)
- else:
- print('unknown command')
- parser.print_help()
|