Get a favicon from an URL using the Google API

Google has an API that returns a favicon of a certain domain. The URLs are such as https://s2.googleusercontent.com/s2/favicons?domain=${domain}&sz=${size}. Replace ${domain} and ${size} with the desired domain and size.

Example:

html
<img src = 'https://s2.googleusercontent.com/s2/favicons?domain=https://erikmartinjordan.com&sz=32'></img>
<img src = 'https://s2.googleusercontent.com/s2/favicons?domain=https://google.com&sz=32'></img>
<img src = 'https://s2.googleusercontent.com/s2/favicons?domain=https://twitter.com&sz=32'></img>

Result:

erikmartinjordan.com favicon google.com favicon twitter.com favicon

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.