I no longer have any faith that any API will stick around all that long. Search APIs are becoming fewer and fewer. Google1 still offers the Ajax Search API, but it’s not convenient to use with System Services and such because it requires non-default libraries to work in Ruby and other scripting languages. It’s easy in PHP, though. It’s not my favorite language to use for local scripting, but it was the easiest solution to the problem. I think…
Took me a couple of tries, but I got a Bash script working (calling PHP because PHP isn’t available as an interpreter in Automator) that you can use as a Lucky Link service that takes input on STDIN and returns a Markdown Link with the passed text. Perfect for System Services. I put together a 3-pack: Lucky Link, Wikipedia Link and Link Blog Post. The “Link Blog Post” Service requires editing to set the blog to search. Just put your site URL into the $site variable and you’re good to go.
I’m revising the Blogsmith Bundle2 search features (which are currently broken) with this, which should revive the most useful parts of the bundle. I’m also porting it to Sublime Text 2, but progress has been slow. I’ll get there.
Here’s the basic script from the Services, followed by a wikipedia linking version:
Here’s the download for the 3 services:
Google Lucky Link Services v1.1
Lucky linking System Services that return Markdown links.
Updated Wed Sep 26 2012.