![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuQGO3ImMjBzNmNzM4EjMmVjNlBTOhZTZzQDN4I2YyAzYfdWbp9CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.png)
开源了一个获取任何站点 favicon 的类库,供使用。
RetrieveFavicon
Project GitHubRetrieve favicon from any website url using C#.
A part of project
GuGuJianKongbackend API.
Retrieve favicon type
- direct retrieve
$website url/favicon.ico
- retrieve
from website content where containshref
<link rel="* icon" href="..." />
-
href
<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
作者:
Parry出处:
http://www.cnblogs.com/parry/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。