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

后端 未结 7 961
夕颜
夕颜 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:35

    It's called a favicon, and all you have to do is:

    1. If there's an icon at /favicon.ico, use that.
    2. Otherwise, get the content of the page, and extract the location from . You’ll need to use an HTML parser and find the with a rel of either icon or shortcut icon.

提交回复
热议问题