RetrieveFavicon 获取任何站点的 favicon
开源了一个获取任何站点 favicon 的类库,供使用。
原文发表于我的技术博客
RetrieveFavicon
Project GitHub
Retrieve favicon from any website url using C#.
A part of project GuGuJianKong backend API.
Retrieve favicon type
- direct retrieve
$website url/favicon.ico
- retrieve
href
from website content where contains<link rel="* icon" href="..." />
- retrieve
href
from website content where contains<link rel="apple-touch-icon" href="..." />
Usage
{% codeblock lang:csharp%}
[TestMethod]
public void CanGetFaviconIco()
{
var faviconUrl = Common.Helper.RetrieveFavicon.Favicon.RetrieveFavicon("https://github.com/parryqiu");
Debug.Print(faviconUrl);
Assert.IsTrue(faviconUrl != null);
}