I’m writing an app with a feature that will let the user choose from a list of common websites, then type a query in an entry box and hit “search.” So I need to be able to get the URL format to make a search on a given website. For example, Google is http://www.google.com/search?q=x, while Amazon is http://www.amazon.com/s/field-keywords=x.
My hope is that I won’t have to build a list of these formats myself. Are there any libraries for doing this, or sites that provide an API? The web app launcher YubNub has commands to search many sites, but they don’t seem to have a public API.
OpenSearch documents were designed to save you from having to build this yourself – there are a number of directories of OpenSearch documents for many sites.
For most purposes I use the Mycroft project from MozDev to get lists of popular sites’ search documents.