我正在尝试从此链接获取 html 页面,并使用 HAP 类库将内容存储到 C# 中的特定文件中。我对 HtmlWeb 类的 Get 方法很感兴趣。它编译并运行得非常好,但从未创建过“file.txt”。这是课程及其客户。有人可以帮忙吗:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
namespace WebCrawler
{
class Crawler
{
public Crawler() { }
public Crawler(string Url)
{
this.Url = Url;
HtmlWeb page = new HtmlWeb();
Console.WriteLine(Url);
HtmlDocument doc = page.Load(Url);
page.Get(Url, "file.txt");
}
public string Url
{
get;
set;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
namespace WebCrawler
{
class Program
{
static void Main(string[] args)
{
Crawler crawler = new Crawler("https://code.google.com/p/abot/");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
namespace WebCrawler
{
class Program
{
static void Main(string[] args)
{
Crawler crawler = new Crawler("https://code.google.com/p/abot/");
}
}
}
谢谢