fix: fix bug
This commit is contained in:
parent
434a0787b8
commit
d1d8e400ba
|
@ -54,9 +54,9 @@ func (c *Core) Init() {
|
||||||
Args: []string{
|
Args: []string{
|
||||||
"--disable-extensions",
|
"--disable-extensions",
|
||||||
"--disable-gpu",
|
"--disable-gpu",
|
||||||
|
"--start-maximized",
|
||||||
"--no-sandbox",
|
"--no-sandbox",
|
||||||
"--window-size=500,450",
|
"--window-size=500,450",
|
||||||
"--start-maximized",
|
|
||||||
"--mute-audio",
|
"--mute-audio",
|
||||||
"--window-position=0,0",
|
"--window-position=0,0",
|
||||||
"--ignore-certificate-errors",
|
"--ignore-certificate-errors",
|
||||||
|
@ -84,6 +84,7 @@ func (c *Core) Init() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.browser = browser
|
c.browser = browser
|
||||||
|
|
||||||
context, err := c.browser.NewContext()
|
context, err := c.browser.NewContext()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -158,7 +159,10 @@ func (c *Core) Login() ([]Cookie, error) {
|
||||||
removeNode(page)
|
removeNode(page)
|
||||||
|
|
||||||
screen, _ := page.Screenshot()
|
screen, _ := page.Screenshot()
|
||||||
|
|
||||||
var result []byte
|
var result []byte
|
||||||
|
os.WriteFile("screen1.png", screen, 0666)
|
||||||
|
|
||||||
buffer := bytes.NewBuffer(result)
|
buffer := bytes.NewBuffer(result)
|
||||||
_ = Clip(bytes.NewReader(screen), buffer, 0, 0, 525, 35, 755, 255, 0)
|
_ = Clip(bytes.NewReader(screen), buffer, 0, 0, 525, 35, 755, 255, 0)
|
||||||
c.Push("markdown", fmt.Sprintf(" \n>点开查看登录二维码\n>请在五分钟内完成扫码", "data:image/png;base64,"+base64.StdEncoding.EncodeToString(buffer.Bytes())))
|
c.Push("markdown", fmt.Sprintf(" \n>点开查看登录二维码\n>请在五分钟内完成扫码", "data:image/png;base64,"+base64.StdEncoding.EncodeToString(buffer.Bytes())))
|
||||||
|
|
|
@ -185,7 +185,7 @@ func (c *Core) LearnVideo(cookies []Cookie) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
links, _ := getLinks("video")
|
links, _ := getLinks("video")
|
||||||
if score.Content["video"].CurrentScore < score.Content["video"].MaxScore || score.Content["video_time"].CurrentScore < score.Content["video_time"].MaxScore {
|
if !(score.Content["video"].CurrentScore >= score.Content["video"].MaxScore && score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore) {
|
||||||
log.Infoln("开始加载视频学习模块")
|
log.Infoln("开始加载视频学习模块")
|
||||||
// core := Core{}
|
// core := Core{}
|
||||||
//core.Init()
|
//core.Init()
|
||||||
|
@ -248,7 +248,7 @@ func (c *Core) LearnVideo(cookies []Cookie) {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
if score.Content["video"].CurrentScore >= score.Content["video"].MaxScore || score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore {
|
if score.Content["video"].CurrentScore >= score.Content["video"].MaxScore && score.Content["video_time"].CurrentScore >= score.Content["video_time"].MaxScore {
|
||||||
log.Infoln("检测到本次视频学习分数已满,退出学习")
|
log.Infoln("检测到本次视频学习分数已满,退出学习")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue