node-yql is a YQL client for node.js
Yahoo! Query Language is an expressive SQL-like language that lets you query, filter, and join data across Web services. With YQL, apps run faster with fewer lines of code and a smaller network footprint.
Yahoo! and other websites across the Internet make much of their structured data available to developers, primarily through Web services. To access and query these services, developers traditionally endure the pain of locating the right URLs and documentation to access and query each Web service.
With YQL, developers can access and shape data across the Internet through one simple language, eliminating the need to learn how to call different APIs.
- SELECT title,abstract FROM search.web WHERE query="pizza";
- SELECT * FROM weather.forecast WHERE location = 90066;
- SELECT * FROM twitter.user.timeline WHERE id = 'yql';
- SELECT * FROM flickr.photos.interestingness(20);
You may find more examples at the YQL console
First, make sure you have Node installed. You can find instructions for installing it at http://nodejs.org/#download
With Node installed, you can install the node-yql module 2 ways:
-
The easiest method is to use NPM, node's package manager. Once you have NPM installed, simply run:
$ npm install yql
-
Or, you can clone the github repository, and just be sure you add this module's path to the $NODE_PATH env variable
$ git clone http://github.com/drgath/node-yql.git
A basic example
yql.js exports a single method, exec.
function exec (string query [, function callback] [, object params] [, object httpOptions])
- query - A YQL query
- callback - A callback function that receives the result of the query
- params - Optional parameters for use within the YQL request querystring. Typical uses; including environment files, variable replacement within the YQL statement.
- httpOptions - Additional HTTP options
- ssl: A boolean true/false flag to enable HTTPS (default: false)
- Any valid HTTP header
- Documentation: http://developer.yahoo.com/yql/guide/
- YQL Console: http://developer.yahoo.com/yql/console/