问题描述
有一个内置的DLL,这将使我从一个字符串的链接列表。我想送一个字符串与有效的HTML,并将它解析所有的链接。我记得好象有东西被内置到.NET程序或非托管库。
Is there a built in dll that will give me a list of links from a string. I want to send in a string with valid html and have it parse all the links. I seem to remember there being something built into either .net or an unmanaged library.
我发现,看起来很有希望一对夫妇的开源项目,但我觉得有一个内置的模块。如果不是我可能需要使用其中的一个。我只是不想在这一点上的外部依赖,如果它是没有必要的。
I found a couple open source projects that looked promising but I thought there was a built in module. If not I may have to use one of those. I just didn't want an external dependency at this point if it wasn't necessary.
推荐答案
SubSonic.Sugar.Web.ScrapeLinks 似乎做你想要的一部分,但它抓住了HTML代码的URL,而不是从一个字符串。您可以检查出其执行这里。
SubSonic.Sugar.Web.ScrapeLinks seems to do part of what you want, however it grabs the html from a url, rather than from a string. You can check out their implementation here.
这篇关于使用C#解析HTML链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!