gpt4 book ai didi

c# - 在 WinRT 应用程序中搜索谷歌

转载 作者:太空宇宙 更新时间:2023-11-03 11:10:41 24 4
gpt4 key购买 nike

我正在尝试向我的 WinRT 应用添加谷歌搜索功能。我必须在不使用 google api 的情况下执行此操作。我检索了谷歌搜索页面,但它是一堆 html 标签。我如何解析此搜索页面以分别获取每个搜索结果?

string url = "http://www.google.com/search?q=" + txtSearchKey.Text.Trim();
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
System.Net.Http.HttpResponseMessage resp = await client.GetAsync(url);
txtResult.Text = await resp.Content.ReadAsStringAsync();

最佳答案

您可以尝试使用可从 nuget 或 here 获得的 HTMLAgility Pack 来完成此操作

关于c# - 在 WinRT 应用程序中搜索谷歌,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14174063/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com