-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter.js
21 lines (18 loc) · 843 Bytes
/
twitter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var Twit = require('twit');
const API_KEY = process.env.API_KEY;
const CONSUMER_KEY = process.env.CONSUMER_KEY;
const CONSUMER_SECRET = process.env.CONSUMER_SECRET;
const ACCESS_TOKEN = process.env.ACCESS_TOKEN;
const ACCESS_TOKEN_SECRET = process.env.ACCESS_TOKEN_SECRET;
var T = new Twit({
consumer_key: CONSUMER_KEY // Your Consumer Key
, consumer_secret: CONSUMER_SECRET // Your Consumer Secret
, access_token: ACCESS_TOKEN // Your Access Token
, access_token_secret: ACCESS_TOKEN_SECRET // Your Access Token Secret
});
T.get('search/tweets', { q: 'amirjohnson', count: 10 }, function(err, data, response) {
// Do something with the JSON data returned.
// (Consult Twitter's documentation on the format:
// https://dev.twitter.com/rest/reference/get/search/tweets)
console.log(data);
});