Pygmy
Pygmy

Reputation: 1268

c# : get nr of google hits for a search term

I'm writing a C# forms app, and I have list of strings (descriptions of some thing or another). I'd like to sort that list based on the amount of hits Google returns for each string.

So how do I actually get the amount of google-hits for a specified search-term ? Do I need to go screen-scraping, or is there an easy solution ?

Cheers :)

Edit: To clarify and show my simplest case of use : Suppose I have a text input box, and a button "Get amount of hits"... When the button is pressed, I want a label to show the amount of hits Google returns for the specified text. So - in a desktop application, how do I get the amount of Google-hits for a specific string ?

Upvotes: 0

Views: 621

Answers (2)

user703016
user703016

Reputation: 37945

Ugly way that comes to mind :

Launch request to http://www.google.com/search?q=your+request Extract number from <div id=resultStats>.

Yuk.

Upvotes: 1

jeroenh
jeroenh

Reputation: 26782

You can probably use the Google Custom Search API for this

Upvotes: 0

Related Questions