forked from jsha/blocktogether
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twurl.js
29 lines (27 loc) · 762 Bytes
/
twurl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
(function() {
var twitter = require('./setup').twitter,
BtUser = require('./setup').BtUser;
BtUser.find({
where: {
screen_name: process.argv[2]
}
}).then(function(user) {
if (!user) {
process.stdout.write('User ' + process.argv[2] + ' not found.\n');
process.exit(1);
}
twitter.oa.get("https://api.twitter.com/1.1/" + process.argv[3],
user.access_token, user.access_token_secret,
function(err, data, response) {
if (err) {
process.stdout.write(JSON.stringify(err) + '\n');
} else {
var out = JSON.stringify(JSON.parse(data), null, 2);
process.stdout.write(out + '\n');
}
});
}).catch(function(err) {
process.stdout.write(err + '\n');
});
})();