|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"github.com/chromedp/chromedp"
|
|
|
+ "io/ioutil"
|
|
|
"log"
|
|
|
"time"
|
|
|
|
|
|
@@ -85,12 +86,13 @@ func (self *ToolController) GetHaibaoWithGoogle() {
|
|
|
fmt.Println("error occured!")
|
|
|
log.Fatal(err)
|
|
|
}
|
|
|
- //fileName := fmt.Sprintf("%s.png", title)
|
|
|
- //// 将截图保存到文件
|
|
|
- //err = ioutil.WriteFile(fileName, buf, 0644)
|
|
|
- //if err != nil {
|
|
|
- // log.Fatal(err)
|
|
|
- //}
|
|
|
+ fileName := fmt.Sprintf("%s.png", "shot_screen")
|
|
|
+ // 将截图保存到文件
|
|
|
+ err = ioutil.WriteFile(fileName, buf, 0644)
|
|
|
+ if err != nil {
|
|
|
+ log.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
fmt.Println("image buf:", buf)
|
|
|
self.Ctx.Output.Header("Content-Type", "image/png")
|
|
|
self.Ctx.Output.Body(buf)
|