我在 C# 中使用一种方法来下载网站的源代码,但相关的 html 标记并不总是存在。例如“<a href”。
这是方法:
public static string GetHTMLCodeByUrl(string url)
{
// Create web client.
WebClient client = new WebClient();
// Download string.
string htmlCode = client.DownloadString(url);
return htmlCode;
}
谢谢