123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/usr/bin/env python
- # -*- encoding: utf-8 -*-
- '''
- @Contact : liuyuqi.gov@msn.cn
- @Time : 2023/05/20 09:34:58
- @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
- @Desc :
- '''
- from crawl_yuque.yuque import YuQue
- import sys,re,os
- from crawl_yuque.options import parser_args
- def main(argv=None):
- """Main entry point of the program"""
- try:
- args = parser_args()
- if args.get('version'):
- print("0.0.1")
- sys.exit(0)
- command = args.get('command','')
- if command == '':
- # logging.error("command is empty")
- # argparser.print_help()
- sys.exit(1)
- if command =="serve" or command =="server":
- # from apps import create_app
- # app = create_app()
- # app.run(host='127.0.0.1', port=5000, debug=True)
- return
- if command == "markdown":
- crawl = YuQue(args)
- if(args["url"] != ''):
- url = args["url"]
- crawl.get_book(url=url)
- else:
- url = input("请输入语雀文档链接:")
- crawl.get_book(url=url)
- if command == "help":
- return
- if command == "pdf":
- crawl = YuQue(args)
- crawl.pdf()
- except KeyboardInterrupt:
- sys.exit('\nERROR: Interrupted by user')
|