获取title:
static void Main(string[] args)
{
WebClient wc = new WebClient();
string result = wc.DownloadString("url");
Match mc = Regex.Match(result, @"(?is)<title>(?<title>.?)</title>");
Console.WriteLine(mc.Groups["title"].Value);
}
获取keywords,如果把keywords换成description则匹配description
static void Main(string[] args)
{
WebClient wc = new WebClient();
string result = wc.DownloadString("url");
string rex="<meta\s+name=\"keywords\"\s+content=\"(.?)\"";
Match mc = Regex.Match(result, rex);
Console.WriteLine(mc.Groups[1].Value);
}