0

Html Agility Pack 出现问题 当我运行我的代码时,它显示“无法连接到远程服务器”有人知道为什么吗?

这是代码:

public void Crawler(string url, int pid)
{
    HtmlWeb hw = new HtmlWeb();
    try
    {
        HtmlAgilityPack.HtmlDocument doc = hw.Load(url);
        HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//a[@class='metatag-topi metatag-keywords']");
        HtmlNodeCollection nodes2 = doc.DocumentNode.SelectNodes("//div[@class='pagination']/a[@href]");
        HtmlNodeCollection phone = doc.DocumentNode.SelectNodes("//p[@class='phone fRight ml10']");

html代码:

<h2 class="header">
<a class="metatag-topic metatag-keywords" title="" href="/Directory/d.482"> ادارات، سازمان ها و تشکیلات</a>
</h2>
4

0 回答 0