Projects STRLCPY scan4all Commits dcc944e8
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    spider/catch_http.go
    skipped 79 lines
    80 80   return uuid.NewV4().String()
    81 81  }
    82 82   
    83  -/*执行截图*/
     83 +/*
     84 +执行截图
     85 +--remote-debugging-port=9222
     86 +参考:https://github.com/chromedp/chromedp/issues/1131
     87 + 
     88 +chromedp.Evaluate(js, &height), 返回最后一行js语句的结果
     89 +*/
    84 90  func DoFullScreenshot(url, path string) bool {
    85 91   opts := append(chromedp.DefaultExecAllocatorOptions[:],
    86  - chromedp.Flag("headless", true),
     92 + chromedp.NoDefaultBrowserCheck,
     93 + chromedp.Flag("headless", false),
    87 94   chromedp.Flag("ignore-certificate-errors", true),
     95 + chromedp.Flag("disable-web-security", true),
     96 + chromedp.Flag("disable-extensions", true), //开启插件支持
     97 + chromedp.Flag("disable-default-apps", true),
     98 + chromedp.Flag("disable-gpu", true), //开启 gpu 渲染
     99 + chromedp.Flag("hide-scrollbars", true),
     100 + chromedp.Flag("mute-audio", true),
     101 + chromedp.Flag("no-sandbox", true),
     102 + chromedp.Flag("no-default-browser-check", true),
     103 + chromedp.NoFirstRun, //设置网站不是首次运行
    88 104   chromedp.WindowSize(MaxWidth, MinHeight),
     105 + chromedp.Flag("blink-settings", "imagesEnabled=true"),
     106 + chromedp.Flag("enable-automation", false),
     107 + chromedp.UserAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"),
    89 108   )
    90 109   allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
    91 110   defer cancel()
    skipped 218 lines
Please wait...
Page is in error, reload to recover