How to get larger favicon from Google's api?

依然范特西╮ 提交于 2019-12-04 02:38:20

Favicons are specified either as part of the HTML page, the HTTP response to a request for a page, or simply by being hosted at a default location.

That's true for all sites. There's plenty of browser extensions that can help you figure out the favicons a page send, if you don't manage by hand. For example, right clicking in firefox, "Page Info", "Media", "sort by type"->"Icon" should show all icons that a browser can find. It's not usual to have Icons larger than 32x32, and google might not be an exception.

Also be aware that the .ico format can contain multiple Icon sizes that not all tools show. So saving that .ico on your computer and inspecting it with a tool known to deal with all sizes contained in a single file might help.

Last word of advice: You're dealing with the logo, the very core of their brand, of a multi-billion dollar company. You might want to check with their policy of using that logo in your project. Probably it's OK (for example, browser don't seem to get in trouble for having a google logo for their google search box), but I'd still take care not to raise the impression that you're association a product of your own making with their logo.

Editted: The below answer is no longer valid, but the code is freely available on github:

Github -> Favicons for all!

Original answer

You can also try Statvoo's Favicon API, e.g.

https://api.statvoo.com/favicon/?url=google.com

https://api.statvoo.com/favicon/?url=stackoverflow.com

etc..

They also have quite a few other API's you can use if you look around. Most of which are free and have been around for years.

According to https://news.ycombinator.com/item?id=17190599:

Unless that endpoint can also return other resolutions, Favicon Kit offers more: https://api.faviconkit.com/twitter.com/144 https://api.faviconkit.com/twitter.com/16

(Though, I will say, the URIs returned for Twitter and the image sizes don't actually align in those cases. The first is actually 192ˣ192 pixels, and the second is 32ˣ32 pixels. That seems odd. Maybe they should have endpoints like domain/large, domain/medium, domain/small?)

Here's some Favicon Fetchers I have found

For Favicon Grabber it will return as JSON list of icon URLs.

Alternatively you can load the main page of the site and figure it out from there: https://stackoverflow.com/a/1990487/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!