client: Windows 客户端(WinUI3 壳 + agent-core;调试用 Electron 壳存档);localserver token 改为常数时间比较
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// kuaishou 快手执行器(CDP:cp.kuaishou.com)。
|
||||
package kuaishou
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"everypublish/agentcore/internal/exec"
|
||||
"everypublish/agentcore/internal/exec/cdnbase"
|
||||
"everypublish/agentcore/internal/exec/cdp"
|
||||
"everypublish/agentcore/internal/vault"
|
||||
"everypublish/shared/proto"
|
||||
)
|
||||
|
||||
// Executor 快手发布执行器
|
||||
type Executor struct {
|
||||
base *cdnbase.Platform
|
||||
}
|
||||
|
||||
// New 构造执行器
|
||||
func New(v *vault.Vault, rootDir, proxy, chromePath string, headless bool) *Executor {
|
||||
p := &cdnbase.Platform{
|
||||
Vault: v,
|
||||
RootDir: rootDir,
|
||||
Proxy: proxy,
|
||||
ChromePath: chromePath,
|
||||
Headless: headless,
|
||||
ReceiptDir: rootDir + "/receipts",
|
||||
Name: "kuaishou",
|
||||
LoginDomain: ".kuaishou.com",
|
||||
PublishCfg: cdp.PublishConfig{
|
||||
UploadURL: "https://cp.kuaishou.com/article/publish/video",
|
||||
SuccessMarker: "article/manage/video",
|
||||
FileInputSel: "input[type=\"file\"]",
|
||||
TitleSel: "input[placeholder*=\"标题\"]",
|
||||
DescSel: "[contenteditable=\"true\"]",
|
||||
PublishBtnSel: "button:has-text(\"发布\")",
|
||||
FormWait: 180 * time.Second,
|
||||
SuccessWait: 120 * time.Second,
|
||||
},
|
||||
LoginCfg: cdp.QRLoginConfig{
|
||||
LoginURL: "https://cp.kuaishou.com/",
|
||||
LoginPathMarker: "passport.kuaishou.com",
|
||||
QRSelector: ".qrcode-img, img[src*=qrcode], .qrcode img",
|
||||
SuccessWait: 3 * time.Minute,
|
||||
},
|
||||
}
|
||||
return &Executor{base: p}
|
||||
}
|
||||
|
||||
// Platform 平台标识
|
||||
func (e *Executor) Platform() string { return "kuaishou" }
|
||||
|
||||
// Execute 发布
|
||||
func (e *Executor) Execute(ctx context.Context, task exec.Task) exec.Result {
|
||||
return e.base.Publish(ctx, task)
|
||||
}
|
||||
|
||||
// SolveChallenge 扫码登录
|
||||
func (e *Executor) SolveChallenge(ctx context.Context, ch proto.Challenge, onQR func(qrToken, qrURL string)) (bool, string) {
|
||||
return e.base.SolveChallenge(ctx, ch, onQR)
|
||||
}
|
||||
Reference in New Issue
Block a user