arminrosu / twitter-open-data-table

Open Data Table for twitter timeline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twitter Open Data Table

An Open Data Table definition for use in YQL.

Since twitter closed unauthenticated access to their API, getting a user's public stream is difficult to do in javascript. This is meant to make it a bit easier.

Originally developed for use in jQuery Lifestream.

Usage

To get the recent tweets of @neiltyson:

USE "http://arminrosu.github.io/twitter-open-data-table/table.xml" AS twitter;
SELECT * FROM twitter WHERE screen_name = "neiltyson"

View it in the YQL Console.

Response Format

This table tries to emulate the twitter API as much as possible and return data, when available, in the same format as the statuses/user_timeline endpoint. Currently, this is format for a tweet:

{
	"id": "3.5210371347895091E17",
	"text": "Still trying to accept the fact that a pitcher for the Oakland  @Athletics  in Major League Baseball ( @MLB ) is named Balfour.",
	"created_at": "1372783041",
	"user": {
		"id": "1.9725644E7",
		"entities": {
			"user_mentions": [
				"Athletics",
				"MLB"
			]
		},
		"screen_name": "neiltyson",
		"name": "Neil deGrasse Tyson",
		"id_str": "19725644"
	},
	"id_str": "352103713478950912"
}

Please note, dates are expressed in Unix Time, not the non-standard Twitter format. This is for ease of usage. Also, numeric ID's are in scientific notation, due to YQL transformations.

Additional Files

  • execute.js - contains most of the code. For use in local development with Mozilla Rhino. YQL supports xpath selectors (via the y object). Rhino doesn't, but supports more advanced E4X selectors. Hence this file contains both selectors, where necessary.
  • results.html - sample html containing the the results of the htmlQuery YQL query, for use in execute.js.

Resources

Some helpful links to get you started:

To Do

  • Parse tweet text better / faster.

License

Licensend under the MIT License.

About

Open Data Table for twitter timeline


Languages

Language:JavaScript 100.0%