普通网友 2017-02-16 12:28
浏览 292

如何使用golang拍摄网站的屏幕截图?

What I'm looking to do, given a URL and take a screenshot of the website using golang. I searched for results but i didn't get any. Can anyone please help me.

  • 写回答

3条回答 默认 最新

  • doutian3010 2017-02-16 12:46
    关注

    There is no pure golang way to do at the moment this since it must involve a browser is some form.

    The easiest path to achieve this functionality is probably:

    • Find a nice NodeJS library to take website screenshots
    • Create a NodeJS script that is suits your needs for taking screenshots (i/o and settings)
    • Execute this NodeJS script from Golang and handle the results in your Golang code

    Not the cleanest method to get this done though - if you want it cleaner you probably have to build/find a golang package that controls a browser so you can skip the NodeJS middleman.

    评论

报告相同问题?

悬赏问题

  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?
  • ¥15 关于#vue.js#的问题:修改用户信息功能图片无法回显,数据库中只存了一张图片(相关搜索:字符串)
  • ¥15 texstudio的问题,
  • ¥15 spaceclaim模型变灰色
  • ¥15 求一份华为esight平台V300R009C00SPC200这个型号的api接口文档
  • ¥15 字符串比较代码的漏洞
  • ¥15 欧拉系统opt目录空间使用100%
  • ¥15 ul做导航栏格式不对怎么改?