-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtweets.js
31 lines (25 loc) · 1.07 KB
/
tweets.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
30
31
var Twitter = require('twitter')
var util = require('util')
var fs = require('fs')
var longUrl = 'http://www.nytimes.com/2014/03/16/magazine/silicon-valleys-youth-problem.html'
var shortUrl = 'http://nyti.ms/1gp29ue'
var twitterClient = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_KEY,
access_token_secret: process.env.TWITTER_ACCESS_SECRET
})
console.log(process.env.TWITTER_CONSUMER_KEY)
console.log(process.env.TWITTER_CONSUMER_SECRET)
console.log(process.env.TWITTER_ACCESS_KEY)
console.log(process.env.TWITTER_ACCESS_SECRET)
twitterClient.search(longUrl, {count: 500}, function (longData) {
twitterClient.search(shortUrl, {count: 500}, function (shortData) {
var finalData = longData
finalData.statuses = finalData.statuses.concat(shortData.statuses)
fs.writeFileSync('data.json', JSON.stringify(finalData))
})
})
// twitterClient.search(shortUrl, {count: 100}, function (data) {
// fs.writeFileSync('shortUrl.json', JSON.stringify(data))
// })