[英]How can I limit the number of returned Google search results in this C# program?
我只想使用以下C#代碼片段返回四個結果。 我該怎么做? 我知道我可能只解析返回的結果,但是如果可能的話,我寧願只抓四個。
var searchTerm = "pizza boxes";
using (var web = new WebClient())
{
web.Headers.Add("Referrer", "http://localhost:49360/");
var result = web.DownloadString(String.Format(
"http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={0}",
searchTerm));
Console.WriteLine(result);
}
在此先感謝您的幫助!
認為您可以設置兩個參數:
start=1;
rsz='large'
rsz
值可以設置為small
或large
,small將獲取4個結果,而large將獲取8個結果。
start
值可以被設置為任何其他整數,從該特定行啟動。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.