Any way to grab a logo icon from website URL, programmatically?

后端 未结 7 871
夕颜
夕颜 2021-01-01 01:08

I am in the process of creating an activity where I will show the list of website visited with its logo and its alias name chosen by user.

e.g.

7条回答
  •  礼貌的吻别
    2021-01-01 01:39

    Use this website:

    https://besticon-demo.herokuapp.com/allicons.json?url=www.stackoverflow.com

    It will find all logos for a website in multiple sizes and return a nice json string with meta data including the url to the icon. You simply replace www.stackoverflow.com with your domain.

    The site also has a gui for entering in websites manually if you prefer:

    https://besticon-demo.herokuapp.com/
    

    Here is a sample string returned from querying for the stack overflow website:

    {
       "url":"www.stackoverflow.com",
       "icons":[
          {
             "url":"http://stackoverflow.com/apple-touch-icon.png",
             "width":158,
             "height":158,
             "format":"png",
             "bytes":3445,
             "error":null,
             "sha1sum":"c78bd457575a3221c6b3d0d17ffb00ffc63d7cd0"
          },
          {
             "url":"http://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico?v=4f32ecc8f43d",
             "width":32,
             "height":32,
             "format":"ico",
             "bytes":5430,
             "error":null,
             "sha1sum":"4f32ecc8f43d0986b9c6ce9f37999e86c0b829ef"
          },
          {
             "url":"http://stackoverflow.com/favicon.ico",
             "width":32,
             "height":32,
             "format":"ico",
             "bytes":5430,
             "error":null,
             "sha1sum":"4f32ecc8f43d0986b9c6ce9f37999e86c0b829ef"
          }
       ]
    }
    

提交回复
热议问题