Skip to content

Instantly share code, notes, and snippets.

@chrisweb
Created July 6, 2013 14:09
Show Gist options
  • Save chrisweb/5939997 to your computer and use it in GitHub Desktop.
Save chrisweb/5939997 to your computer and use it in GitHub Desktop.
https://github.com/jdub/node-twitter module configuration (options) to make the nodejs module compatible with the new twitter 1.1 rest and streaming API
var TwitterModule = require('twitter');
var util = require('util');
twitterModuleConfiguration: {
// oauth
consumer_key: '000000000000000000000',
consumer_secret: '000000000000000000000000000000000000',
access_token_key: '0000000000000000000000000000000000',
access_token_secret: '00000000000000000000000000000000000',
// twitter api 1.1
rest_base: 'https://api.twitter.com/1.1',
stream_base: 'https://stream.twitter.com/1.1',
search_base: 'https://api.twitter.com/1.1/search',
user_stream_base: 'https://userstream.twitter.com/1.1',
site_stream_base: 'https://sitestream.twitter.com/1.1'
}
var Twitter = new TwitterModule(twitterModuleConfiguration);
twit.search('nodejs OR #node', function(data) {
console.log(util.inspect(data));
});
@chrisweb
Copy link
Author

chrisweb commented Jul 6, 2013

You also need to edit twitter js and edit line 182:

var url = this.options.search_base + '/tweets.json';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment