2006-12-16
Factor interface to Google Search
About a year ago I wrote some Factor code to use the Google SOAP API to run automated Google searches. I wanted to put together the results of a quick search so I fixed the code to work with the latest Factor release. The code is in my repository and will hopefully eventually make to the main Factor repository. You can get it with:
darcs get http://www.bluishcoder.co.nz/repos/factor
An example of usage is:
"mygooglekey" "factor language" google-search
This will return a sequence of 'search-item' tuples. These contain the url, snippet and title of the result from the search request. Only the top 10 results are currently returned.
The 'mygooglekey' must be the Google SOAP API key. The bad news is Google deprecated this api a couple of weeks ago. They are keeping the service running but aren't providing any new keys. The intent is to migrate people to the Ajax search API. Unfortunately this API only runs within browsers so is not much good for automated server side searches. There's some discussion on the Google API forums about this change.
So if you have a Google key for the SOAP service this code might be useful. Otherwise it won't be. If you google around you might be able to find keys...
Here's an example of usage (it may take a few seconds to run): http://factor.bluishcoder.co.nz/search-rankings. It gives the top ten results from a few google searches on Sit and Go Poker Tournament Strategy. It also gives the pagerank of the sites in the search. The pagerank was obtained from the trynt pagerank API service. The pageranks are cached so I don't keep hitting the trynt service.