-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
39 lines (28 loc) · 889 Bytes
/
Copy pathapp.js
File metadata and controls
39 lines (28 loc) · 889 Bytes
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
30
31
32
33
34
35
36
37
38
39
const Twitter = require('twitter');
const config = require('./config.js');
const T = new Twitter(config);
const params = {
q: '#badminton',
result_type: 'recent',
lang: 'en'
}
var tweetid=0;
// Initiate your search using the above paramaters
T.get('search/tweets', params, (err, data, response) => {
if(err){
return console.log('Search error is '+err);
}
// If there is no error, proceed
// Check returned tweets
tweetid = data.statuses[0].id_str;
console.log('Tweet id is '+tweetid);
});
T.post('statuses/retweet/:id', tweetid, (err2, response2) => {
if (response2) {
console.log('Retweeted!!!');
}
// if there was an error while tweeting
if (err2) {
console.log('Something went wrong ', err2);
}
});