Giter Club home page Giter Club logo

node-yql's Introduction

Build Status

node-yql

node-yql is a YQL client for node.js

What is YQL?

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.

Example YQL Queries

  • 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

Installing node-yql

$ npm install yql

Example

var YQL = require('yql');
var query = new YQL('SHOW TABLES');
query.exec(function (error, response) {
	// Do something with results (response.query.results)
});

You can also chain the methods:

YQL('SELECT * FROM weather.forecast WHERE (location = @zip)').setParam('zip', 94089).setConfig('ssl', true).exec(fn)

Documentation

Full documentation can be found at derek.github.com/node-yql

function YQL (string query [, object options])

  • query - A YQL query
  • options
    • ssl: A boolean true/false flag to enable HTTPS (default: false)
    • headers: Object of valid HTTP headers (default {})
    • env: Environment files (default: http://datatables.org/alltables.env)

Additional YQL Resources

node-yql's People

Contributors

andreasmadsen avatar codewhale avatar derek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-yql's Issues

How to add config for proxy

HI, How can I add the proxy setting to the YQL request like below?

https://stackoverflow.com/a/6781592

I tried this

var query = new YQL(queryString);
query.setConfigs({
      host: proxyUrl,
      port: 8080
 });

But I don't even know what kind option I can add this config so host or post is probably wrong.
This doesn't work at all.

POST method and request headers

Hi,
I know this is probably not the best place to ask but the YQL doc. site is not very node-yql friendly.

My question is. How can I make a POST (instead of GET) request and how to set the POST parameters? Also is there any way to set some request headers?

how to use node-yql with token & secret?

Apologies in advance if this is the wrong place to ask but I'm trying to get at a user's info & I already have a token & secret & now need to use those with this to make a YQL query.

Thanks in advance!

(edit: haven't tried just including them as parameters (as you do {"zip": 94089} in the weather example) -- will do & update this a bit later)

(nevermind -- I ended up using node-oauth to make req's using yahoo's web API. turned out much better for me anyway)

-h

example cannot run

https://github.com/derek/node-yql/blob/master/examples/example.js#L20

      condition = response.query.results.channel.item.condition;
                                                     ^

TypeError: Cannot read property 'condition' of undefined
    at YQL.exec (/Users/willin/Documents/w2fs/beian-domain/demo/index.js:15:54)
    at /Users/willin/Documents/w2fs/beian-domain/demo/node_modules/yql/yql.js:276:9
    at /Users/willin/Documents/w2fs/beian-domain/demo/node_modules/yql/yql.js:243:17
    at parseJSON (/Users/willin/Documents/w2fs/beian-domain/demo/node_modules/yql/yql.js:335:5)
    at YQL._handleResponse (/Users/willin/Documents/w2fs/beian-domain/demo/node_modules/yql/yql.js:229:9)
    at Request.self.callback (/Users/willin/Documents/w2fs/beian-domain/demo/node_modules/request/request.js:121:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/Users/willin/Documents/w2fs/beian-domain/demo/node_modules/request/request.js:978:14)
    at emitOne (events.js:120:20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.