Is it technically possible to take a screenshot of a website programmatically?

后端 未结 5 760
醉酒成梦
醉酒成梦 2021-01-02 21:49

Do you think is technically possible to take a screeshot of a website programmatically?

I would like to craft a scheduled Python task that crawls a list of websites

5条回答
  •  独厮守ぢ
    2021-01-02 22:26

    It's certainly technically possible.

    You would probably have to render the HTML directly onto an image file (or more likely, onto an in-memory bitmap that's written to an image file once completed).

    I don't know any libraries to do this for you (apart from a modified WebKit, perhaps)... but there's certainly websites that do this.

    Of course, this is a bit more involved than just opening the page in a browser on a machine and taking a screenshot programatically, but the result would likely be better if you don't care about the result from a specific browser.

提交回复
热议问题