我想获得谷歌搜索结果使用HTML敏捷包,但我没有得到正确的页面。我得到的网页是谷歌的主页,获取谷歌搜索结果在c#
(如果你尝试将其粘贴到一个正常的浏览器,它会变成下面的网址)
private void GotoGoogleButton(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("https://www.google.com"));
}
private void getResultsButton(object sender, EventArgs e)
{
url = webBrowser1.Url.ToString();
start_parsing(url);
}
public void start_parsing(string URL_)
{
//This function is used to Parse Html source using Html Agility Pack into nodes, and take the important ones (mainly : a,form,iframe)
HtmlAgilityPack.HtmlDocument document = webGet.Load(URL_);
var metaTags = document.DocumentNode.SelectNodes("//a");
// ...
// Continue with parsing...
}
我如何获得的搜索结果,而不是主页?
您必须格式化你的代码(在您的文章,并在你的编辑)。否则,人们无法阅读。 –