End road work
Request.YQL
Extends: Request.JSONP
A very simple extension that accepts a YQL query and makes the call returning data from YQL in json format (default).
Accepts all inherited options from the Request.* classes up the Request.JSONP family line but url must be the service url. The default value of format is“json” it can be any of the defined YQL formats.
NB: The .send() method needs to be called and a onSuccess defined for it to do anything. Example:
new Request.YQL("show tables",{
onSuccess: function(data) {
console.log(data);
}
}).send();
/** ============================================================================
* YQL driver
* Extends: Request.JSONP
*
* @version 1.0
*
* @license MIT-style license
* @author Rhys Burnie
* @copyright Author <rhys [at] hybridgarden.com>
* @param {String} YQL query
* @param {Object} Request options
* NB: options.url must be to the YQL service (default to v1 path)
*/
if( ($chk(Request) && $chk(Request.JSONP)) && !$chk(Request.YQL) ) {
Request.YQL = new Class({
Extends: Request.JSONP,
options: {
url: "http://query.yahooapis.com/v1/public/yql?",
format: 'json'
},
initialize: function(query,options) {
this.parent(options);
if (!query)
return;
this.options.url = this.options.url + 'q=' + encodeURIComponent(query) + '&format='+this.options.format;
},
success: function(data, script) {
this.parent(data, script);
}
});
}