YQL is a clever idea

— 2 minute read

Yahoo! Query Langauge is one of those wonderful ideas that you wish you'd thought of yourself. Take the various disparate APIs from Yahoo products and give them a unified SQL-like method of querying. Lots of data made easier to use and accessible through a more standard approach, so:

select * from flickr.photos.interestingness(10)

Gets you 10 interesting photos from Flickr. Nice and simple if you know SQL, and many web developers do.

I've done some playing with the various APIs Yahoo's products make available, but hunting through varying bits of documentation was a pain, and they all worked slightly differently, so this is a really helpful single point of contact.

But that's just the surface layer, it gets more interesting digging in a bit. YQL also allows you to query external data like any RSS feeds, CSV files, JSON and so on. It's like Yahoo Pipes in this way, only less visual. One of the data options is to pull other people's (X)HTML and run XPATH on it. So I could get all the anchors within H2s on this page with:

select * from html where url="http://eclecticdreams.com" and xpath='//h2/a'

So it acts as a nice middleman for data from pages with half-decent semantics. You could grab Microformat rich material, for example, and then mix them in with other data. Which means again, a lot more data in one place, with one interface, where I can hack it together using a language I'm already half familiar with.

That makes mashing things up a lot less headachey.