开发者

Using google search API services in the backend using C#

I'm trying to use the google search API services in the backend using C#. I know there is ajax api that you can use with javascript. so what is the similar thing in C# so I can use it at the backend level.

I know that I can do it this way:

var searchTerm = "Paris";
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);

but it doesn't give me any flexibility. e.x how can I set a site restriction and specify the search catagory?? e.x I want to be able to search news and finance articles for the term "Microsoft" from the CNN website only and store the urls in text file. How can I do tha开发者_如何学运维t?? please let me know, I have been struggling for many days looking it up online and I'm getting very frustrated. thanks a lot,


You have to postprocess the results from the Google AJAX Search API using a C# JSON implementation - there is advice on how to do that here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜