Google already offers feeds for Google News, Blog Search, Google Video, so you can use the search results in your applications or sites. There's also a Google API for web search that uses SOAP, but it's limited to 1000 queries per day.
For the first time, Google offers a new kind of API, unified for web search, image search, blog search and video search. The API uses JSON, so creating applications in JavaScript is easy. You must know that this API is unofficial, so the details can change.
Google JSON API is the foundation of SearchMash, an experimental site created by Google.
So how do you get the search results using this API? You just load this page:
http://www.searchmash.com/results/[query]. You just have to replace [query] with the actual query. If you use this format: http://www.searchmash.com/results/[query]?i=11&n=10, you request 10 search results, starting with the result number 11. The formats for image search, blog search and video search are:
http://www.searchmash.com/results/images:[query]
http://www.searchmash.com/results/blogs:[query]
http://www.searchmash.com/results/video:[query]
The JSON object you get from Google has a list of members that are very easy to understand, like: estimatedCount (the number of search results) or results, which is an array that describes the search results. To make cross-domain requests, you may need to create a web proxy, like shown here.
How to prevent your clear phone case from turning yellow
38 minutes ago
Thanks for the heads up, mate!
ReplyDeleteI'm writing a parser for the thingy, just for kicks ;), and found out that the following was a good regex. Just so you guys know...
m/\"([^"]*)\":\"([^"]*)\"/g
You don't have to write a parser yourself. There are JSON decoders for every platform/language.
ReplyDeleteOther interesting API for search route diagrams of climbing, canyoning, diving, biking... near a input coordinates.
ReplyDeleteThis API was good but have a lot of limitations.
ReplyDeleteIt's easy write a parser yourself and if you do it you don't have any limitations.
Here is a free online Google parser:
Google parser
If you want to read the article about it:
Get Google results in a list of clean URLs
Is there any way to make the JSON responce call a function in your javascript like the Yahoo API e.g "callback=processresults"?
ReplyDeleteIf not, how do you access the JSON object directly??
Any help would be much appreciated
Guys? Can we have a callback function?
ReplyDeleteI'll be your best friend!
PHP5's JSON_decode function just does it. if you are using PHP5 this might be helpful:
ReplyDelete$gJSON=file_get_contents($url);
$gArray = JSON_decode($gJSON,true);
this converts the JSON formatted array to PHP array.
can i download the google json api source? I need implement this in my page and i can't depend of that page :P
ReplyDeleteGoogle offers JSON output for the Ajax Search API.
ReplyDeleteSearchMash taken offline...
ReplyDeletecan you modify it so it works like "google to some string, parse out urls and names of links [:10], print them out"?
ReplyDeleteI think searchmash.com closed this api forever. But we can develop another one :))
ReplyDeleteI think that Google closed SearchMash completely.
ReplyDeleteOh, well... Other opportunities will come :)
yea no more search mash it seems - bing and yahoo still have open api's
ReplyDeleteThere is some .net dll at http://googsearcher.com
ReplyDelete