search keywords in google through c# window application

前端 未结 2 1337
清酒与你
清酒与你 2020-12-16 08:05

i want to work on a scraper program which will search keyword in google. i have problem in starting my scraper program. my problem is: let suppose window application(c#) hav

2条回答
  •  抹茶落季
    2020-12-16 08:31

    i have googled my problem and found solution to the above problem... we can use google API for this purpose...when we add reference to google api then we will add the following namespace in our program...........

    using Google.API.Search;
    

    write the following code in button click event

     var client = new GwebSearchClient("http://www.google.com");
            var results = client.Search("google api for .NET", 100);
            foreach (var webResult in results)
            {
                //Console.WriteLine("{0}, {1}, {2}", webResult.Title, webResult.Url, webResult.Content);
                listBox1.Items.Add(webResult.ToString ());
            }
    

    test my solution and give comments .........thanx everybody

提交回复
热议问题