捕獲和轉換Web的工具

網頁到Icon API-具有GrabzIt的Favicon提取器

The Webpage to Icon API converts a URL to an icon. Try this 演示 to see it in action. The Webpage to Icon API is not simply a favicon grabber.

But instead bases the final icon on all the available icons for the webpage. If no favicons or meta icons are available it will generate one for the webpage. The chosen icon, the background and any border selected can change depending on the users selections.

To use the API replace the APPLICATION KEY text below with 您的應用程序密鑰. Then set the size parameter, which defaults to 32.

Finally specify the webpage that you want to turn into an convert. By passing the required URL to the URL parameter. In the following example, we convert https://www.astropioneer.blog/ into a 48x48 pixel image.

//api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/
包含的URL參數 & or ? 字符必須經過URL編碼。

You should place the url parameter at the end of the querystring. This helps in avoiding the need to encode most URLs when using the API.

While you can download the image using a server-side language like PHP. You can also display it directly on a web page or use it in JavaScript as shown below. Remember that when using the API in a webpage. You must add the domain of the webpage to the list of 授權域.

<img src="//api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/"/>
<script>
fetch('https://api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/')
.then(response => response.blob())
.then(blob => {
    console.log(blob);
});
</script>

You can also transform an image by selecting the desired transform from the options below. For instance, you can see an example here where the transform makes the resulting image sepia.

//api.grabz.it/services/icon?key=Sign in to view your Application Key&transform=sepia&size=48&url=https://www.astropioneer.blog/

參數

The API accepts the following four parameters.

姓名 產品描述 選項
關鍵 您的申請密鑰 此參數是必需的 創建一個圖像圖標
網址 要轉換的網頁網址 intoa圖片 此參數是必需的 to create an image image
尺寸 The size of the resulting square image So 32 would result in a 32x32px image
改造 The transform to apply to the resulting image.
默認為無。
blackandwhite - create a black and white image
grayscale - create a grayscale image
inverse - invert the colors of the image
sepia - create a sepia colored image
資源 定義用於的首選圖標來源
generating the finished image.
默認為全部。
all -使用所有類型的圖標
favicon -僅使用收藏夾圖標
metadata -僅使用網頁元數據圖標

錯誤

The API can return the following error codes.

推薦碼 產品描述
100 未指定網址
103 缺少應用程序密鑰
104 無法識別的應用程序密鑰
114 Size Invalid
401 使用此API的域必須是 授權.
500 需要升級