Skip to content

Argument Instruction

Naibo Wang edited this page Apr 23, 2024 · 14 revisions

命令行参数说明

当使用命令行执行任务时,程序后面的跟的参数说明:

  • --id:任务执行ID,任务文件存在execution_instances文件夹内。默认:[0]
  • --saved_file_name:保存文件名称,如不指定则默认为随机数。
  • --read_type:任务读取方式,remote为从服务器读取,local为从本地execution_instances文件夹直接读取id.json文件。默认:remote。如设置成local则不需要启动EasySpider本体即可直接执行任务。
  • --server_address:服务器地址,只用于当--read_typeremote的情况下,默认值:http://localhost:8074
  • --user_data:是否带用户配置执行任务,1为是0为否,默认值0
  • --config_file_name:配置文件名称,默认值:config.json。配置文件中的absolute_user_data_folder字段记录了用户的配置目录,如需要带用户配置执行,则需要在配置文件此字段中指定配置目录路径。
  • --config_folder: 配置文件所在路径,默认为空,即EasySpider根目录。
  • --headless:是否以无头模式,即不显示浏览器界面执行,1为是0为否,默认值0
  • --keyboard:是否要监听键盘以实现暂停功能,如果不监听则无法暂停程序,但适用于Debug或者需要程序执行完成自动退出的情况。1为是0为否,默认值1,适用版本:0.5.0及以上。
  • --pause_key:暂停/继续任务执行需要长按的键,可在想要多开时修改按键以分别控制不同任务,也可在保存任务窗口中修改。默认值p,适用版本:0.6.0及以上。
  • --docker_driver:是否使用docker执行,常用于Linux环境中,如果需要,请指定docker容器地址,如http://localhost:4444/wd/hub,默认值为空表示不使用docker执行。

Command Line Arguments Explanation

When executing a task from the command line, the program may accept the following arguments:

  • --id: Task execution ID. The task file is stored in the execution_instances folder. Default: [0].
  • --saved_file_name: The name of the saved file. If not specified, it defaults to a random number.
  • --read_type: Task reading type. Use remote to read from a server or local to directly read the id.json file from the local execution_instances folder. Default: remote. If set to local, the EasySpider ontology does not need to be started to execute the task directly.
  • --server_address: The server address. Only used when --read_type is set to remote. Default value: http://localhost:8074.
  • --user_data: Indicates whether to execute the task with user configuration. Set to 1 for yes or 0 for no. Default value: 0.
  • --config_file_name: The name of the configuration file. Default value: config.json. The absolute_user_data_folder field in the configuration file records the user's configuration directory. If executing the task with user configuration, specify the configuration directory path in this field of the configuration file.
  • --config_folder: The path to the configuration file. The default is empty, which means the EasySpider root directory.
  • --headless: Indicates whether to run in headless mode, i.e., without displaying the browser interface. Set to 1 for yes or 0 for no. Default value: 0.
  • --keyboard: Determines whether to listen to the keyboard to implement pause functionality. If not listening, the program cannot be paused, but it's suitable for Debug or situations where the program needs to complete execution and exit automatically. 1 means "yes", 0 means "no". Default value: 1, applicable version: 0.6.0 and above. --pause_key: The key that needs to be long-pressed to pause/resume task execution. It can be modified to control different tasks separately when you want to run multiple instances, and can also be changed in the save task window. Default value: p, applicable version: 0.6.0 and above.
  • --docker_driver: Specifies whether to execute using Docker, commonly used in Linux environments. If required, please provide the Docker container address, such as http://localhost:4444/wd/hub. The default value is empty, indicating that Docker is not used for execution.