yql-node
A small module providing utility methods for accessing YQL API. Provides optional OAuth access helper. Most other node modules for YQL failed for me on large query strings so this one uses POST method.
Modified to support returning json with a property called format, and a chainable constructor function.
It is also possible to set query parameters to utilize e.g. datatables.org. An example is provided below but you can also check their website for more information.
Installation
npm install yql-node --save
Usage
//call public endpoints out of the box by simple require var yqlXML = ; //will return XML results var yql = ; //will return JSON results //or set the instance to use OAuth and non-public endpoint like this var yqlWithOAuthXML = ; //returns XML var yqlWithOAuth = ; //returns JSON var query = 'select * from html where url="http://example.com"; '; //these two calls will produce same results //response passed to your callback will a string containing the YQL query result //so you read data straight from it //returns JSON yql; //after calling formatAsXML() it will return XML yql; //returns XML yqlXML; //you can set the format via a property yqlXMLformat = 'json'; //and now it will return JSON yqlXML; //this will call the non-public endpoint yqlWithOAuth; //before calling any of the above you can use the following //to enable usage of datatables.org yql;
Dependencies and credits
Contributing
If you find yourself wishing for a feature it doesn't have - feel free to fork, add it and generate a pull request. All contributions welcome.
Licence
Release History
- 0.2.1 Ability to pass query parameter to utilize datatables.org
- 0.2.0 Added ability to request json format of the response
- 0.1.5 Bug fixes and example improvement
- 0.1.0 Initial release