hubstudio-cli 是随 Hubstudio 客户端分发的独立命令行工具,用于通过命令行调用 Hubstudio 客户端的 Local API。hubstudio-cli 命令行工具:| 操作系统 / 架构 | 下载链接 | 默认二进制文件名 |
|---|---|---|
| macOS (Intel / x64) | 点击下载 | hubstudio-cli |
| macOS (Apple Silicon / arm64) | 点击下载 | hubstudio-cli |
| Linux (x64) | 点击 下载 | hubstudio-cli |
| Windows (x64) | 点击下载 | hubstudio-cli.exe |
PATH 路径下(例如 /usr/local/bin):hubstudio-cli.exe。hubstudio-cli.exe 所在的文件夹路径添加到系统的“环境变量 -> Path”中,即可在任意目录下通过命令行直接运行。[!TIP] 在 macOS / Linux 系统中,如果未将工具加入全局环境变量,执行时需带上当前路径前缀(如 ./hubstudio-cli)。在 Windows 系统中,可通过命令提示符(CMD)或 PowerShell 运行 hubstudio-cli.exe。
hubstudio-cli --local-api-key "你的API Key" start-browser containerCode=11895682hubstudio-cli --help
hubstudio-cli help start-browser
hubstudio-cli start-browser --help| 场景 | 命令示例 |
|---|---|
| 查询客户端版本 | hubstudio-cli client-version |
| 打开环境 | hubstudio-cli start-browser containerCode=11895682 |
| 关闭环境 | hubstudio-cli stop-browser containerCode=11895682 |
| 查询运行状态 | hubstudio-cli browser-status |
| 查询指定环境 | hubstudio-cli browser-status --json '{"containerCodes":["11895682"]}' |
| 列出屏幕 | hubstudio-cli list-displays |
| 查询环境列表 | hubstudio-cli env-list --json '{"page":1,"pageSize":20}' |
| 查看帮助 | hubstudio-cli --help |
--local-api-key 选项或设置 HUBSTUDIO_LOCAL_API_KEY 环境变量)。http://127.0.0.1:6873。如果客户端使用了其它端口,CLI 会优先通过客户端 IPC 查询当前端口,也可以用 -p 手动指定。hubstudio-cli 调用 Local API。无头模式必须提供 App Key 登录参数:./Hubstudio.AppImage \
--no-sandbox \
--headless=true \
--app-id="你的 app_id" \
--app-secret="你的 app_secret" \
--login-group-code=你的团队codehubstudio-cli 调用。hubstudio-cli --local-api-key "你的API Key" start-browser containerCode=11895682-p, --port <n> Local API 端口
-H, --host <h> 主机,默认 127.0.0.1
--local-api-key <key> Local API 安全认证密钥
--timeout <seconds> HTTP 请求超时秒数,默认 30 秒,0 表示不限制
-j, --json <json> 整段 JSON 请求体,覆盖 key=value
--json-stdin 从标准输入读取 JSON 请求体
-h, --help 显示帮助
-V, --version 显示版本| 环境变量 | 说明 |
|---|---|
HUBSTUDIO_LOCAL_API_PORT | IPC 查询失败且未传 -p 时使用 |
HUBSTUDIO_LOCAL_API_KEY | 等价 --local-api-key |
HUBSTUDIO_CLI_TIMEOUT | 等价 --timeout |
--timeout 影响。HTTP 请求阶段默认最多等待 30 秒,如果希望调整 HTTP 请求等待时间,可以使用 --timeout:hubstudio-cli --timeout 30 browser-status
HUBSTUDIO_CLI_TIMEOUT=30 hubstudio-cli browser-status--timeout 的单位是秒。未传时默认 30 秒;传入 0 表示不限制 HTTP 请求等待时间。{
"code": 408,
"msg": "CLI request timeout after 30s. The Local API operation may still be running in Hubstudio client."
}| 平台 | IPC 地址 |
|---|---|
| Windows | \\.\pipe\Hubstudio-cli |
| macOS/Linux | /tmp/Hubstudio-cli |
HUBSTUDIO_LOCAL_API_PORT 和默认端口 6873。hubstudio-cli -p 6873 browser-status
HUBSTUDIO_LOCAL_API_PORT=6873 hubstudio-cli browser-statuskey=value,复杂参数推荐使用 --json 或 --json-stdin。key=value 转成 JSON 请求体:hubstudio-cli client-version
hubstudio-cli start-browser containerCode=11895682 isHeadless=true pageZoom=100| 输入 | JSON 类型 |
|---|---|
true / false | boolean |
null | null |
100 / 1.5 | number |
{...} / [...] | object / array |
| 其它 | string |
--json:hubstudio-cli arrange-browsers --json '{"x":10,"y":10,"width":600,"height":500,"gapX":20,"gapY":20,"colNum":3}'echo '{"containerCode":"11895682"}' | hubstudio-cli start-browser --json-stdinclient-versionHubstudio-cli IPC Server 获取当前客户端版本号。该命令不调用 Local API,也不需要请求体参数。hubstudio-cli client-version{
"code": 0,
"msg": "Success",
"data": {
"version": "3.52.0",
"pid": 12345
}
}hubstudio-cli 的每个子命令都对应一个 Local API POST 接口。命令名由 API 路径去掉 /api/v1/ 后将 / 替换为 - 得到,例如 /api/v1/env/list 对应 env-list。POST 调用本地 Local API。--json,避免 shell 对特殊字符的转义问题。required 标记为准;部分业务必填字段可能由接口逻辑校验,调用前请结合官网文档确认。env-listPOST /api/v1/env/list| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
containerCodes | array<string> | 否 | 指定环境ID查询环境 |
containerName | string | 否 | 指定环境名称查询环境 |
createEndTime | string | 否 | 创建时间-截止时间 example: yyyy-MM-dd HH:mm:ss |
createStartTime | string | 否 | 创建时间-起始时间 example: yyyy-MM-dd HH:mm:ss |
ipAddress | string | 否 | IP地址查询 |
proxyTypeNames | array<string> | 否 | 代理类型 HTTP、HTTPS、SSH、Socks5、Oxylabsauto、Lumauto 、Luminati、 smartproxy、IPIDEA、Iphtml、不使用代理 |
remark | string | 否 | 指定环境备注信息查询环境 |
tagCode | integer | 否 | 分组编号 默认不传参,若需要查询“未分组”的环境,传任意 |
tagNames | array<string> | 否 | 环境分组名称数组 查询指定分组的环境 |
current | integer | 否 | 当前页面 |
size | integer | 否 | 分页条数 最多200条。 |
serviceProvider | string | 否 | 环境内代理所属服务商 ROLA_IP、922S5、通用api |
env-createPOST /api/v1/env/create| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
containerName | string | 是 | 环境名 限制60字以内 |
remark | string | 否 | 环境备注信息 |
tagName | string | 否 | 指定环境所属分组的名称 若分组名称不存在,将默认环境未分组。 |
cookie | string | 否 | 设置cookie 支持JSON格式的cookie |
asDynamicType | integer | 是 | IP变更提醒 0-关闭提醒(默认)1-开启提醒 |
proxyTypeName | string | 是 | 1. 自定义代理类型:HTTP、HTTPS、SSH、Socks5、Oxylabsauto、Lumauto_HTTP、Lumauto_HTTPS、Luminati_HTTP、Luminati_HTTPS、smartproxy、Iphtml_HTTP、Iphtml_Socks5、IPIDEA、不使用代理2. API提取代理类型: Socks5_ROLA_IP、HTTPS_ROLA_IP、Socks5_922S5、HTTP_922S5、HTTPS_922S5、Socks5_通用api、HTTP_通用api、HTTPS_通用api、Socks5_IPIDEA-API、HTTP_IPIDEA-API、HTTPS_IPIDEA-API |
ipGetRuleType | integer | 否 | IP提取方式 1-IP失效时提取新IP ,2-,每次打开环境时提取新IP。API提取代理时必填 |
linkCode | string | 否 | 提取链接 API提取代理时必填 |
proxyServer | string | 否 | 代理主机 自定义代理时必填 |
proxyPort | integer | 否 |