使用C#解析HTML链接 [英] Parse HTML links using C#

查看:142
本文介绍了使用C#解析HTML链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个内置的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.

推荐答案

<一个href="http://web.archive.org/web/20090510122547/http://subsonichelp.com/html/d4d577b3-5089-17a2-c667-db50ad3c9ff9.htm"相对=nofollow> 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链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆