mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-06-06 09:57:25 +08:00
feat(core): 新增控制爬虫 参数起始页面的页数start_page;perf(argparse): 向命令行解析器添加程序参数起始页面页数和关键字
This commit is contained in:
10
main.py
10
main.py
@@ -38,7 +38,11 @@ async def main():
|
||||
choices=["qrcode", "phone", "cookie"], default=config.LOGIN_TYPE)
|
||||
parser.add_argument('--type', type=str, help='crawler type (search | detail | creator)',
|
||||
choices=["search", "detail", "creator"], default=config.CRAWLER_TYPE)
|
||||
|
||||
parser.add_argument('--start', type=int, help='crawler type (number of start page)',
|
||||
default=config.START_PAGE)
|
||||
parser.add_argument('--keyword', type=str, help='crawler type (please input keywords)',
|
||||
default=config.KEYWORDS)
|
||||
|
||||
# init db
|
||||
if config.SAVE_DATA_OPTION == "db":
|
||||
await db.init_db()
|
||||
@@ -48,7 +52,9 @@ async def main():
|
||||
crawler.init_config(
|
||||
platform=args.platform,
|
||||
login_type=args.lt,
|
||||
crawler_type=args.type
|
||||
crawler_type=args.type,
|
||||
start_page=args.start,
|
||||
keyword=args.key
|
||||
)
|
||||
await crawler.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user