网上查到有个第3方接口(网页截屏大师)可以实现截取网页长图,只能针对部分网站调用
首先,先在https://www.screenshotmaster.com/ 注册一个账号,在用户中心获取到一个唯一的Token,并保存
然后使用Python脚本调用截屏大师的接口获取截图,代码示例:
import urllib.parse import urllib.request import ssl ssl._create_default_https_context = ssl._create_unverified_context # 参数 token = "62ea1704908d6" url = urllib.parse.quote_plus("https://www.baidu.com") width = 1280 height = 800 full_page = 1 # 构造URL query = "https://www.screenshotmaster.com/api/v1/screenshot" query += "?token=%s&url=%s&width=%d&height=%d&full_page=%s" % (token, url, width, height, full_page) # 调用API urllib.request.urlretrieve(query, "./screenshot.png")
标签:www,截长,width,python,urllib,height,如何,https,query From: https://www.cnblogs.com/muxiaomu/p/16650963.html