| name | polyv-live-cli |
| description | 管理保利威直播服务,包括频道管理、推流操作、商品管理、优惠券、回放、文档和统计数据。当用户需要管理直播频道、配置推流设置、管理商品、处理优惠券、查看直播数据或管理回放录像时使用。 |
| allowed-tools | Bash(npx polyv-live-cli@latest:*) |
保利威直播 CLI
执行前验证
在执行任何 CLI 命令之前,必须先验证账号认证状态。
1. 检测认证状态
npx polyv-live-cli@latest account list
2. 配置认证(如需要)
如果用户未配置认证,引导用户提供 AppID 和 AppSecret:
请提供你的保利威 AppID 和 AppSecret:
- 访问 https://www.polyv.net/ 后台获取
- 路径:云直播 -> 设置 -> 开发者信息
然后用用户提供的凭据配置:
npx polyv-live-cli@latest account add <名称> --app-id <appId> --app-secret <appSecret>
npx polyv-live-cli@latest account set-default <名称>
3. 验证配置成功
npx polyv-live-cli@latest channel list
快速开始
npx polyv-live-cli@latest account add myaccount --app-id <id> --app-secret <secret>
npx polyv-live-cli@latest use myaccount
npx polyv-live-cli@latest channel create -n "我的直播"
npx polyv-live-cli@latest stream get-key -c <channelId>
npx polyv-live-cli@latest stream start -c <channelId>
npx polyv-live-cli@latest stream status -c <channelId> -w
身份认证
npx polyv-live-cli@latest account add <名称> --app-id <id> --app-secret <secret>
npx polyv-live-cli@latest account list
npx polyv-live-cli@latest account set-default <名称>
npx polyv-live-cli@latest account delete <名称>
npx polyv-live-cli@latest use <名称>
npx polyv-live-cli@latest channel list --appId <id> --appSecret <secret>
npx polyv-live-cli@latest channel list -a <账号名称>
频道命令
npx polyv-live-cli@latest channel create -n <名称> [-d <描述>] [--scene <场景类型>]
npx polyv-live-cli@latest channel list [-P <页码>] [-l <数量>] [--keyword <关键词>]
npx polyv-live-cli@latest channel get -c <频道ID>
npx polyv-live-cli@latest channel update -c <频道ID> [-n <名称>] [-d <描述>]
npx polyv-live-cli@latest channel delete -c <频道ID> [-f]
npx polyv-live-cli@latest channel batch-delete --channelIds <id1> <id2> ...
推流命令
npx polyv-live-cli@latest stream get-key -c <频道ID>
npx polyv-live-cli@latest stream start -c <频道ID>
npx polyv-live-cli@latest stream stop -c <频道ID>
npx polyv-live-cli@latest stream status -c <频道ID> [-w]
npx polyv-live-cli@latest stream push -c <频道ID> -f <文件>
npx polyv-live-cli@latest stream verify -c <频道ID> [-d 60]
npx polyv-live-cli@latest stream monitor -c <频道ID> [-r 5]
商品命令
npx polyv-live-cli@latest product list -c <频道ID>
npx polyv-live-cli@latest product add -c <频道ID> --name <名称> --price <价格>
npx polyv-live-cli@latest product get -c <频道ID> -p <商品ID>
npx polyv-live-cli@latest product update -c <频道ID> -p <商品ID> [--name <名称>]
npx polyv-live-cli@latest product delete -c <频道ID> -p <商品ID>
优惠券命令
npx polyv-live-cli@latest coupon create -c <频道ID> -n <名称> --discount <金额>
npx polyv-live-cli@latest coupon list -c <频道ID>
npx polyv-live-cli@latest coupon get -c <频道ID> --couponId <优惠券ID>
npx polyv-live-cli@latest coupon delete -c <频道ID> --couponId <优惠券ID>
回放命令
npx polyv-live-cli@latest playback list -c <频道ID>
npx polyv-live-cli@latest playback get -c <频道ID> --videoId <回放ID>
npx polyv-live-cli@latest playback delete -c <频道ID> --videoId <回放ID>
npx polyv-live-cli@latest playback merge -c <频道ID> --videoIds <id1> <id2>
录制设置命令
npx polyv-live-cli@latest record setting get -c <频道ID>
npx polyv-live-cli@latest record setting set -c <频道ID> [--playback-enabled Y|N] [--type single|list] [--origin playback|vod|record]
npx polyv-live-cli@latest record convert -c <频道ID> --file-name <文件名> [--session-id <场次ID>] [--async]
npx polyv-live-cli@latest record set-default -c <频道ID> --video-id <视频ID> [--list-type playback|vod]
场次命令
npx polyv-live-cli@latest session list [-c <频道ID>] [--page <页码>] [--page-size <数量>]
npx polyv-live-cli@latest session get -c <频道ID> --session-id <场次ID>
文档命令
npx polyv-live-cli@latest document list -c <频道ID> [--status <状态>] [--page <页码>] [--page-size <数量>]
npx polyv-live-cli@latest document upload -c <频道ID> --url <文件URL> [--type common|animate] [--doc-name <名称>]
npx polyv-live-cli@latest document delete -c <频道ID> --file-id <文档ID> [--type old|new] [--force]
npx polyv-live-cli@latest document status -c <频道ID> --file-id <文档ID>
统计命令
npx polyv-live-cli@latest statistics overview -c <频道ID>
npx polyv-live-cli@latest statistics viewdata -c <频道ID> [--start-date <日期>]
npx polyv-live-cli@latest statistics summary -c <频道ID>
npx polyv-live-cli@latest statistics export -c <频道ID> -f csv -o report.csv
播放器命令
npx polyv-live-cli@latest player get -c <频道ID>
npx polyv-live-cli@latest player update -c <频道ID> [--autoplay] [--logo <url>]
场景初始化
npx polyv-live-cli@latest setup --list
npx polyv-live-cli@latest setup e-commerce
npx polyv-live-cli@latest setup education
监控命令
npx polyv-live-cli@latest monitor start -c <频道ID>
npx polyv-live-cli@latest monitor stop
聊天消息命令
npx polyv-live-cli@latest chat send -c <频道ID> -m <文本消息>
npx polyv-live-cli@latest chat send -c <频道ID> -i <图片URL>
npx polyv-live-cli@latest chat send -c <频道ID> -m <消息> -n <昵称> -a <角色>
npx polyv-live-cli@latest chat list -c <频道ID>
npx polyv-live-cli@latest chat list -c <频道ID> --page <页码> --size <数量>
npx polyv-live-cli@latest chat list -c <频道ID> --start-day <开始日期> --end-day <结束日期>
npx polyv-live-cli@latest chat delete -c <频道ID> -m <消息ID>
npx polyv-live-cli@latest chat delete -c <频道ID> --clear
禁言踢人命令 (Story 11-2)
npx polyv-live-cli@latest chat ban -c <频道ID> -u <用户ID1,用户ID2>
npx polyv-live-cli@latest chat ban -c <频道ID> -u <用户ID> -o json
npx polyv-live-cli@latest chat ban -u <用户ID1,用户ID2> --global
npx polyv-live-cli@latest chat unban -c <频道ID> -u <用户ID1,用户ID2>
npx polyv-live-cli@latest chat unban -u <用户ID1,用户ID2> --global
npx polyv-live-cli@latest chat kick -c <频道ID> -v <观众ID1,观众ID2> -n <昵称1,昵称2>
npx polyv-live-cli@latest chat kick -c <频道ID> -v <观众ID> -o json
npx polyv-live-cli@latest chat kick -v <观众ID1> -n <昵称1> --global
npx polyv-live-cli@latest chat unkick -c <频道ID> -v <观众ID1> -n <昵称1>
npx polyv-live-cli@latest chat unkick -v <观众ID1> --global
npx polyv-live-cli@latest chat banned list -c <频道ID> --type userId
npx polyv-live-cli@latest chat banned list -c <频道ID> --type ip
npx polyv-live-cli@latest chat banned list -c <频道ID> --type badword
npx polyv-live-cli@latest chat kicked list -c <频道ID>
npx polyv-live-cli@latest chat kicked list -c <频道ID> -o json
签到管理命令 (Story 11-3)
npx polyv-live-cli@latest checkin start -c <频道ID>
npx polyv-live-cli@latest checkin start -c <频道ID> --limit-time 30
npx polyv-live-cli@latest checkin start -c <频道ID> --delay-time 1700734800000
npx polyv-live-cli@latest checkin start -c <频道ID> --message "请签到"
npx polyv-live-cli@latest checkin start -c <频道ID> --force
npx polyv-live-cli@latest checkin list -c <频道ID>
npx polyv-live-cli@latest checkin list -c <频道ID> --page 1 --size 20
npx polyv-live-cli@latest checkin list -c <频道ID> --date 2024-01-15
npx polyv-live-cli@latest checkin list -c <频道ID> --session-id <场次ID>
npx polyv-live-cli@latest checkin result -c <频道ID> --checkin-id <签到ID>
npx polyv-live-cli@latest checkin result -c <频道ID> --checkin-id <签到ID> -o json
npx polyv-live-cli@latest checkin sessions -c <频道ID>
npx polyv-live-cli@latest checkin sessions -c <频道ID> --start-date 2024-01-01 --end-date 2024-01-31
npx polyv-live-cli@latest checkin sessions -c <频道ID> -o json
问答管理命令 (Story 11-4)
npx polyv-live-cli@latest qa send -c <频道ID> --question-id <问题ID>
npx polyv-live-cli@latest qa send -c <频道ID> --question-id <问题ID> --duration 30
npx polyv-live-cli@latest qa send -c <频道ID> --question-id <问题ID> -o json
npx polyv-live-cli@latest qa list -c <频道ID>
npx polyv-live-cli@latest qa list -c <频道ID> -o json
npx polyv-live-cli@latest qa stop -c <频道ID> --question-id <问题ID>
npx polyv-live-cli@latest qa stop -c <频道ID> --question-id <问题ID> -o json
问卷管理命令 (Story 11-4)
npx polyv-live-cli@latest questionnaire create -c <频道ID> --title <问卷标题> --questions '<JSON数组>'
npx polyv-live-cli@latest questionnaire create -c 3151318 --title "满意度调查" --questions '[{"name":"性别","type":"R","options":["男","女"],"required":"Y"}]'
npx polyv-live-cli@latest questionnaire create -c <频道ID> --title <标题> --questions '<JSON>' --custom-questionnaire-id <自定义ID>
npx polyv-live-cli@latest questionnaire list -c <频道ID>
npx polyv-live-cli@latest questionnaire list -c <频道ID> --page 1 --size 20
npx polyv-live-cli@latest questionnaire list -c <频道ID> --session-id <场次ID>
npx polyv-live-cli@latest questionnaire list -c <频道ID> --start-date 2024-01-01 --end-date 2024-01-31
npx polyv-live-cli@latest questionnaire detail -c <频道ID> --questionnaire-id <问卷ID>
npx polyv-live-cli@latest questionnaire detail -c <频道ID> --questionnaire-id <问卷ID> -o json
抽奖管理命令 (Story 11-5)
npx polyv-live-cli@latest lottery create -c <频道ID> --name <抽奖名称> --type <类型> --amount <中奖人数> --prize <奖品名称>
npx polyv-live-cli@latest lottery create -c 3151318 --name "幸运抽奖" --type none --amount 3 --prize "神秘礼品"
npx polyv-live-cli@latest lottery create -c 3151318 --name "邀请抽奖" --type invite --amount 5 --prize "优惠券" --invite-num 3
npx polyv-live-cli@latest lottery create -c 3151318 --name "时长抽奖" --type duration --amount 2 --prize "红包" --duration 10
npx polyv-live-cli@latest lottery list -c <频道ID>
npx polyv-live-cli@latest lottery list -c <频道ID> --page 1 --size 20
npx polyv-live-cli@latest lottery list -c <频道ID> -o json
npx polyv-live-cli@latest lottery get -c <频道ID> --id <抽奖活动ID>
npx polyv-live-cli@latest lottery update -c <频道ID> --id <抽奖活动ID> --name <新名称> --amount <新人数>
npx polyv-live-cli@latest lottery delete -c <频道ID> --id <抽奖活动ID>
npx polyv-live-cli@latest lottery winners -c <频道ID> --lottery-id <抽奖ID>
npx polyv-live-cli@latest lottery winners -c <频道ID> --lottery-id <抽奖ID> --page 1 --limit 20
npx polyv-live-cli@latest lottery records -c <频道ID>
npx polyv-live-cli@latest lottery records -c <频道ID> --session-id <场次ID>
npx polyv-live-cli@latest lottery records -c <频道ID> --start-time <时间戳> --end-time <时间戳>
打赏管理命令 (Story 11-6)
npx polyv-live-cli@latest donate config get -c <频道ID>
npx polyv-live-cli@latest donate config get -c 3151318 -o json
npx polyv-live-cli@latest donate config update -c <频道ID> --cash-enabled Y
npx polyv-live-cli@latest donate config update -c <频道ID> --gift-enabled Y
npx polyv-live-cli@latest donate config update -c <频道ID> --tips "感谢支持!"
npx polyv-live-cli@latest donate config update -c <频道ID> --amounts "0.88,6.66,8.88,18.88"
npx polyv-live-cli@latest donate list -c <频道ID> --start <开始时间戳> --end <结束时间戳>
npx polyv-live-cli@latest donate list -c 3151318 --start 1615772426000 --end 1615858826000
npx polyv-live-cli@latest donate list -c 3151318 --start 1615772426000 --end 1615858826000 --page 2 --size 20
npx polyv-live-cli@latest donate list -c 3151318 --start 1615772426000 --end 1615858826000 -o json
输出格式
大多数命令支持 -o table(默认表格格式)或 -o json(JSON格式,便于程序化处理)。
npx polyv-live-cli@latest channel list -o json
npx polyv-live-cli@latest stream status -c <频道ID> -o json
全局选项
--appId <id>
--appSecret <secret>
--userId <id>
-a, --account <名称>
--verbose
--debug
--timeout <毫秒>
常用工作流程
创建并开始直播
npx polyv-live-cli@latest use myaccount
npx polyv-live-cli@latest channel create -n "新品发布会" -d "新品展示直播"
npx polyv-live-cli@latest stream get-key -c 3151318
npx polyv-live-cli@latest stream start -c 3151318
npx polyv-live-cli@latest stream status -c 3151318 -w
初始化电商直播场景
npx polyv-live-cli@latest setup e-commerce
监控直播质量
npx polyv-live-cli@latest stream verify -c 3151318 -d 120 -i 5
npx polyv-live-cli@latest stream monitor -c 3151318 -r 3 --alerts
详细文档
联系方式