The GrabzIt Python Screenshot API provides the ability to take screenshots of mobile versions of websites, however not all websites have special mobile versions and so it may not work in all circumstances. Mobile screenshot can be requested for both image and PDF screenshots as well as when extracting tables.
為此,您需要使用1傳遞給 setRequestAs
創建對象時,options對象的屬性 圖片, PDF or 表, 如下所示。 然後,這將請求目標網站的移動版本。
為了獲得更真實的手機屏幕截圖,最好將標準的移動瀏覽器寬度傳遞給 browserWidth
的屬性 抓斗ImageOptions 類。 或者,如果要創建PDF,請選擇較小的頁面尺寸。
from GrabzIt import GrabzItClient from GrabzIt import GrabzItImageOptions options = GrabzItImageOptions.GrabzItImageOptions() options.format = "png" options.browserWidth = 320 options.width = 256 options.height = 256 options.requestAs = 1 grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret") grabzIt.URLToImage("https://www.tesla.com", options) grabzIt.Save("http://www.mysite.com/handler.py")