Reputation: 21
I was wondering how it is possible to have a java program search Google. For example, I want to write to program where the user can input the name of a resteraunt and then have the program search the name on Google, find the address, and then return it. I do think it is possible, because I know programs that are web crawlers. But I was wondering how to learn the specific code or way to write that, because I'm not at all certain where to start.
Thank you.
Upvotes: 0
Views: 430
Reputation: 38193
Google has deprecated their search API in favor of a more general Custom Search API:
https://developers.google.com/custom-search/v1/overview
Using your own API key you would do something like the following:
GET https://www.googleapis.com/customsearch/v1?key=INSERT-YOUR-KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
That will return JSON that you can parse to display the data any way you want.
Here's good info on getting started: http://blog.lux-medien.com/2011/08/google-custom-search-java-implementation/
Upvotes: 1
Reputation: 4164
If you are interested in web crawlers, here is an article that details a Java solution.
http://java.sun.com/developer/technicalArticles/ThirdParty/WebCrawler/
Upvotes: 1