Christian Heilmann

Yahoo BOSS keyword extraction API wrappers (JS/PHP)

Thursday, November 13th, 2008 at 3:49 pm

One of my favourite “old school” Yahoo APIs is the term extractor which is a service that extracts relevant keywords from a text you give it.

Yahoo BOSS is now supporting this feature for indexed web sites. While you’d normally just get a list of sites with for example:

http://boss.yahooapis.com/ysearch/web/v1/donkeys?format=xml&appid={appid}

You can get the keywords for each of the pages returned by adding the (so far undocumented) view=keyterms parameter:

http://boss.yahooapis.com/ysearch/web/v1/donkeys?format=xml&view=keyterms&appid={appid}

This can be pretty useful to get a list of keywords related to a certain term.

In order to do this, I’ve written a small API in PHP and JavaScript that gets you the related terms from the first ten search results and returns them as an array.

The PHP API wrapper

The PHP version takes three parameters: the mandatory term to search for, an optional callback method name to wrap around the JSON return value and an optional format parameter that can be set to HTML to return an HTML list instead of a JSON object.

The JavaScript API wrapper

The JavaScript wrapper uses dynamically generated script nodes to retrieve the data and can be used by simply calling a BOSSTERMS.get() method with a search term and the name of a callback method. The return object has a term property, the keywords as an array and a string that is an HTML list of the terms.

Get the lot

You can download the whole BOSS keyword API here. As always, it is BSD licensed, so go nuts using it :)

Tags: , , ,

Share on Mastodon (needs instance)

Share on Twitter

Newsletter

Check out the Dev Digest Newsletter I write every week for WeAreDevelopers. Latest issues:

160: Graphs and RAGs explained and VS Code extension hacks Graphs and RAG explained, how AI is reshaping UI and work, how to efficiently use Cursor, VS Code extensions security issues.
159: AI pipelines, 10x faster TypeScript, How to interview How to use LLMs to help you write code and how much electricity does that use? Is your API secure? 10x faster TypeScript thanks to Go!
158: 🕹️ Super Mario AI 🔑 API keys in LLMs 🤙🏾 Vibe Coding Why is AI playing Super Mario? How is hallucinating the least of our worries and what are rules for developing Safety Critical Code?
157: CUDA in Python, Gemini Code Assist and back-dooring LLMs We met with a CUDA expert from NVIDIA about the future of hardware, we look at how AI fails and how to play pong on 140 browser tabs.
156: Enterprise dead, all about Bluesky and React moves on! Learn about Bluesky as a platform, how to build a React App and how to speed up SQL. And play an impossible game in the browser.

My other work: