RetrieveFavicon 获取任何站点的 favicon

{% codeblock lang:csharp%} [TestMethod] public void CanGetFaviconIco() { var faviconUrl = Common.Helper.RetrieveFavicon.Favicon.RetrieveFavicon("https://github…

Website 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); } {% endcodeblock %}

NuGet References