How to implement Python web page screenshots / screenshots / screenshots?

Time:2021-8-4

For the problem of Python web page screenshots, after searching the Internet, the author summarizes the following implementation schemes,

  • Using pyqt5

  • Using selenium + phantom JS

    The voice of the second method is relatively high. Generally speaking, it is not particularly convenient. Finally, the author found a third-party service provider that specializes in providing web page screenshots, including Python’s code for implementing web page screenshots. Here we introduce it to you. After all, building wheels is not directly on the shoulders of giants. Spending time on our core business is the most important thing.

The service has the following characteristics:

  • Support multiple lines
  • Support login screenshot
  • Support UA transformation
  • Support cookie injection to achieve login screenshot
  • Support custom width and height
  • Support page scrolling screenshots
  • Support setting the delay time before screenshot

The way to use it is also very simple. We open its home pagewww.screenshotmaster.com/Register an account, and then you will get a unique token in the user center. Save the token and don’t disclose it!

Let’s take a look at the parameters it supports:

How to implement Python web page screenshots / screenshots / screenshots?

You can go toAPI documentationPage for more parameters.

Use Python to call the screenshot master’s interface to obtain screenshots:

import urllib.parse

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

OC basis

IOS development interview essential skills chart.png What are objects and what are the objects in OC? An object is an instance of a class; Is an instance created through a class, which is generally called an instance object; Common objects in OC include instance objects, class objects, and metaclass objects; What is a class? What […]