Open SAY-droid427 opened 3 years ago
The very basic prototype to query the hashtags might be like this. We can improve upon it on further review:
const Twitter=require('twitter-v2');
const client=new Twitter({
consumer_key:'',
consumer_secret:'',
access_token_key:'',
access_token_secret:'',
});
(async()=>{
client.get('search/tweets',{query:'#test',count: 10},function(err,data,response){
const tweets=data;
console.log(tweets);
})
})();
I have received access to the Standard Twitter API and so using that I will start work this week.
Using bearer token authentication, and the following GET request: https://api.twitter.com/2/tweets/counts/recent?query=%23tests This returns the count of the number of tweets containing the #tests.
{
"data": [
{
"end": "2021-07-28T19:00:00.000Z",
"start": "2021-07-28T18:34:20.000Z",
"tweet_count": 0
},
{
"end": "2021-07-28T20:00:00.000Z",
"start": "2021-07-28T19:00:00.000Z",
"tweet_count": 11
},
{
"end": "2021-07-28T21:00:00.000Z",
"start": "2021-07-28T20:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-07-28T22:00:00.000Z",
"start": "2021-07-28T21:00:00.000Z",
"tweet_count": 10
},
{
"end": "2021-07-28T23:00:00.000Z",
"start": "2021-07-28T22:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-07-29T00:00:00.000Z",
"start": "2021-07-28T23:00:00.000Z",
"tweet_count": 41
},
{
"end": "2021-07-29T01:00:00.000Z",
"start": "2021-07-29T00:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-07-29T02:00:00.000Z",
"start": "2021-07-29T01:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-07-29T03:00:00.000Z",
"start": "2021-07-29T02:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-07-29T04:00:00.000Z",
"start": "2021-07-29T03:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-07-29T05:00:00.000Z",
"start": "2021-07-29T04:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-29T06:00:00.000Z",
"start": "2021-07-29T05:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-07-29T07:00:00.000Z",
"start": "2021-07-29T06:00:00.000Z",
"tweet_count": 18
},
{
"end": "2021-07-29T08:00:00.000Z",
"start": "2021-07-29T07:00:00.000Z",
"tweet_count": 20
},
{
"end": "2021-07-29T09:00:00.000Z",
"start": "2021-07-29T08:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-07-29T10:00:00.000Z",
"start": "2021-07-29T09:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-07-29T11:00:00.000Z",
"start": "2021-07-29T10:00:00.000Z",
"tweet_count": 10
},
{
"end": "2021-07-29T12:00:00.000Z",
"start": "2021-07-29T11:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-07-29T13:00:00.000Z",
"start": "2021-07-29T12:00:00.000Z",
"tweet_count": 23
},
{
"end": "2021-07-29T14:00:00.000Z",
"start": "2021-07-29T13:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-07-29T15:00:00.000Z",
"start": "2021-07-29T14:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-07-29T16:00:00.000Z",
"start": "2021-07-29T15:00:00.000Z",
"tweet_count": 10
},
{
"end": "2021-07-29T17:00:00.000Z",
"start": "2021-07-29T16:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-07-29T18:00:00.000Z",
"start": "2021-07-29T17:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-07-29T19:00:00.000Z",
"start": "2021-07-29T18:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-07-29T20:00:00.000Z",
"start": "2021-07-29T19:00:00.000Z",
"tweet_count": 11
},
{
"end": "2021-07-29T21:00:00.000Z",
"start": "2021-07-29T20:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-07-29T22:00:00.000Z",
"start": "2021-07-29T21:00:00.000Z",
"tweet_count": 21
},
{
"end": "2021-07-29T23:00:00.000Z",
"start": "2021-07-29T22:00:00.000Z",
"tweet_count": 21
},
{
"end": "2021-07-30T00:00:00.000Z",
"start": "2021-07-29T23:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-07-30T01:00:00.000Z",
"start": "2021-07-30T00:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-30T02:00:00.000Z",
"start": "2021-07-30T01:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-30T03:00:00.000Z",
"start": "2021-07-30T02:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-07-30T04:00:00.000Z",
"start": "2021-07-30T03:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-07-30T05:00:00.000Z",
"start": "2021-07-30T04:00:00.000Z",
"tweet_count": 11
},
{
"end": "2021-07-30T06:00:00.000Z",
"start": "2021-07-30T05:00:00.000Z",
"tweet_count": 19
},
{
"end": "2021-07-30T07:00:00.000Z",
"start": "2021-07-30T06:00:00.000Z",
"tweet_count": 20
},
{
"end": "2021-07-30T08:00:00.000Z",
"start": "2021-07-30T07:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-07-30T09:00:00.000Z",
"start": "2021-07-30T08:00:00.000Z",
"tweet_count": 47
},
{
"end": "2021-07-30T10:00:00.000Z",
"start": "2021-07-30T09:00:00.000Z",
"tweet_count": 31
},
{
"end": "2021-07-30T11:00:00.000Z",
"start": "2021-07-30T10:00:00.000Z",
"tweet_count": 28
},
{
"end": "2021-07-30T12:00:00.000Z",
"start": "2021-07-30T11:00:00.000Z",
"tweet_count": 28
},
{
"end": "2021-07-30T13:00:00.000Z",
"start": "2021-07-30T12:00:00.000Z",
"tweet_count": 33
},
{
"end": "2021-07-30T14:00:00.000Z",
"start": "2021-07-30T13:00:00.000Z",
"tweet_count": 22
},
{
"end": "2021-07-30T15:00:00.000Z",
"start": "2021-07-30T14:00:00.000Z",
"tweet_count": 25
},
{
"end": "2021-07-30T16:00:00.000Z",
"start": "2021-07-30T15:00:00.000Z",
"tweet_count": 18
},
{
"end": "2021-07-30T17:00:00.000Z",
"start": "2021-07-30T16:00:00.000Z",
"tweet_count": 17
},
{
"end": "2021-07-30T18:00:00.000Z",
"start": "2021-07-30T17:00:00.000Z",
"tweet_count": 27
},
{
"end": "2021-07-30T19:00:00.000Z",
"start": "2021-07-30T18:00:00.000Z",
"tweet_count": 17
},
{
"end": "2021-07-30T20:00:00.000Z",
"start": "2021-07-30T19:00:00.000Z",
"tweet_count": 59
},
{
"end": "2021-07-30T21:00:00.000Z",
"start": "2021-07-30T20:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-30T22:00:00.000Z",
"start": "2021-07-30T21:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-07-30T23:00:00.000Z",
"start": "2021-07-30T22:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-07-31T00:00:00.000Z",
"start": "2021-07-30T23:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-07-31T01:00:00.000Z",
"start": "2021-07-31T00:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-31T02:00:00.000Z",
"start": "2021-07-31T01:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-07-31T03:00:00.000Z",
"start": "2021-07-31T02:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-07-31T04:00:00.000Z",
"start": "2021-07-31T03:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-07-31T05:00:00.000Z",
"start": "2021-07-31T04:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-07-31T06:00:00.000Z",
"start": "2021-07-31T05:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-07-31T07:00:00.000Z",
"start": "2021-07-31T06:00:00.000Z",
"tweet_count": 10
},
{
"end": "2021-07-31T08:00:00.000Z",
"start": "2021-07-31T07:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-07-31T09:00:00.000Z",
"start": "2021-07-31T08:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-07-31T10:00:00.000Z",
"start": "2021-07-31T09:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-07-31T11:00:00.000Z",
"start": "2021-07-31T10:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-07-31T12:00:00.000Z",
"start": "2021-07-31T11:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-07-31T13:00:00.000Z",
"start": "2021-07-31T12:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-07-31T14:00:00.000Z",
"start": "2021-07-31T13:00:00.000Z",
"tweet_count": 11
},
{
"end": "2021-07-31T15:00:00.000Z",
"start": "2021-07-31T14:00:00.000Z",
"tweet_count": 11
},
{
"end": "2021-07-31T16:00:00.000Z",
"start": "2021-07-31T15:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-07-31T17:00:00.000Z",
"start": "2021-07-31T16:00:00.000Z",
"tweet_count": 17
},
{
"end": "2021-07-31T18:00:00.000Z",
"start": "2021-07-31T17:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-07-31T19:00:00.000Z",
"start": "2021-07-31T18:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-07-31T20:00:00.000Z",
"start": "2021-07-31T19:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-07-31T21:00:00.000Z",
"start": "2021-07-31T20:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-07-31T22:00:00.000Z",
"start": "2021-07-31T21:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-07-31T23:00:00.000Z",
"start": "2021-07-31T22:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-01T00:00:00.000Z",
"start": "2021-07-31T23:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-01T01:00:00.000Z",
"start": "2021-08-01T00:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-01T02:00:00.000Z",
"start": "2021-08-01T01:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-01T03:00:00.000Z",
"start": "2021-08-01T02:00:00.000Z",
"tweet_count": 85
},
{
"end": "2021-08-01T04:00:00.000Z",
"start": "2021-08-01T03:00:00.000Z",
"tweet_count": 30
},
{
"end": "2021-08-01T05:00:00.000Z",
"start": "2021-08-01T04:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-01T06:00:00.000Z",
"start": "2021-08-01T05:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-01T07:00:00.000Z",
"start": "2021-08-01T06:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-01T08:00:00.000Z",
"start": "2021-08-01T07:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-01T09:00:00.000Z",
"start": "2021-08-01T08:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-01T10:00:00.000Z",
"start": "2021-08-01T09:00:00.000Z",
"tweet_count": 0
},
{
"end": "2021-08-01T11:00:00.000Z",
"start": "2021-08-01T10:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-01T12:00:00.000Z",
"start": "2021-08-01T11:00:00.000Z",
"tweet_count": 18
},
{
"end": "2021-08-01T13:00:00.000Z",
"start": "2021-08-01T12:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-01T14:00:00.000Z",
"start": "2021-08-01T13:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-01T15:00:00.000Z",
"start": "2021-08-01T14:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-08-01T16:00:00.000Z",
"start": "2021-08-01T15:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-08-01T17:00:00.000Z",
"start": "2021-08-01T16:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-08-01T18:00:00.000Z",
"start": "2021-08-01T17:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-01T19:00:00.000Z",
"start": "2021-08-01T18:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-01T20:00:00.000Z",
"start": "2021-08-01T19:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-01T21:00:00.000Z",
"start": "2021-08-01T20:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-01T22:00:00.000Z",
"start": "2021-08-01T21:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-08-01T23:00:00.000Z",
"start": "2021-08-01T22:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-02T00:00:00.000Z",
"start": "2021-08-01T23:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-02T01:00:00.000Z",
"start": "2021-08-02T00:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-02T02:00:00.000Z",
"start": "2021-08-02T01:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-02T03:00:00.000Z",
"start": "2021-08-02T02:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-02T04:00:00.000Z",
"start": "2021-08-02T03:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-02T05:00:00.000Z",
"start": "2021-08-02T04:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-02T06:00:00.000Z",
"start": "2021-08-02T05:00:00.000Z",
"tweet_count": 0
},
{
"end": "2021-08-02T07:00:00.000Z",
"start": "2021-08-02T06:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-02T08:00:00.000Z",
"start": "2021-08-02T07:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-08-02T09:00:00.000Z",
"start": "2021-08-02T08:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-02T10:00:00.000Z",
"start": "2021-08-02T09:00:00.000Z",
"tweet_count": 43
},
{
"end": "2021-08-02T11:00:00.000Z",
"start": "2021-08-02T10:00:00.000Z",
"tweet_count": 39
},
{
"end": "2021-08-02T12:00:00.000Z",
"start": "2021-08-02T11:00:00.000Z",
"tweet_count": 32
},
{
"end": "2021-08-02T13:00:00.000Z",
"start": "2021-08-02T12:00:00.000Z",
"tweet_count": 25
},
{
"end": "2021-08-02T14:00:00.000Z",
"start": "2021-08-02T13:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-08-02T15:00:00.000Z",
"start": "2021-08-02T14:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-02T16:00:00.000Z",
"start": "2021-08-02T15:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-02T17:00:00.000Z",
"start": "2021-08-02T16:00:00.000Z",
"tweet_count": 34
},
{
"end": "2021-08-02T18:00:00.000Z",
"start": "2021-08-02T17:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-02T19:00:00.000Z",
"start": "2021-08-02T18:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-02T20:00:00.000Z",
"start": "2021-08-02T19:00:00.000Z",
"tweet_count": 40
},
{
"end": "2021-08-02T21:00:00.000Z",
"start": "2021-08-02T20:00:00.000Z",
"tweet_count": 19
},
{
"end": "2021-08-02T22:00:00.000Z",
"start": "2021-08-02T21:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-02T23:00:00.000Z",
"start": "2021-08-02T22:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-03T00:00:00.000Z",
"start": "2021-08-02T23:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-03T01:00:00.000Z",
"start": "2021-08-03T00:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-03T02:00:00.000Z",
"start": "2021-08-03T01:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-03T03:00:00.000Z",
"start": "2021-08-03T02:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-03T04:00:00.000Z",
"start": "2021-08-03T03:00:00.000Z",
"tweet_count": 36
},
{
"end": "2021-08-03T05:00:00.000Z",
"start": "2021-08-03T04:00:00.000Z",
"tweet_count": 12
},
{
"end": "2021-08-03T06:00:00.000Z",
"start": "2021-08-03T05:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-03T07:00:00.000Z",
"start": "2021-08-03T06:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-08-03T08:00:00.000Z",
"start": "2021-08-03T07:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-03T09:00:00.000Z",
"start": "2021-08-03T08:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-03T10:00:00.000Z",
"start": "2021-08-03T09:00:00.000Z",
"tweet_count": 19
},
{
"end": "2021-08-03T11:00:00.000Z",
"start": "2021-08-03T10:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-03T12:00:00.000Z",
"start": "2021-08-03T11:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-03T13:00:00.000Z",
"start": "2021-08-03T12:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-08-03T14:00:00.000Z",
"start": "2021-08-03T13:00:00.000Z",
"tweet_count": 13
},
{
"end": "2021-08-03T15:00:00.000Z",
"start": "2021-08-03T14:00:00.000Z",
"tweet_count": 16
},
{
"end": "2021-08-03T16:00:00.000Z",
"start": "2021-08-03T15:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-03T17:00:00.000Z",
"start": "2021-08-03T16:00:00.000Z",
"tweet_count": 38
},
{
"end": "2021-08-03T18:00:00.000Z",
"start": "2021-08-03T17:00:00.000Z",
"tweet_count": 9
},
{
"end": "2021-08-03T19:00:00.000Z",
"start": "2021-08-03T18:00:00.000Z",
"tweet_count": 4
},
{
"end": "2021-08-03T20:00:00.000Z",
"start": "2021-08-03T19:00:00.000Z",
"tweet_count": 21
},
{
"end": "2021-08-03T21:00:00.000Z",
"start": "2021-08-03T20:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-03T22:00:00.000Z",
"start": "2021-08-03T21:00:00.000Z",
"tweet_count": 0
},
{
"end": "2021-08-03T23:00:00.000Z",
"start": "2021-08-03T22:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-04T00:00:00.000Z",
"start": "2021-08-03T23:00:00.000Z",
"tweet_count": 1
},
{
"end": "2021-08-04T01:00:00.000Z",
"start": "2021-08-04T00:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-04T02:00:00.000Z",
"start": "2021-08-04T01:00:00.000Z",
"tweet_count": 3
},
{
"end": "2021-08-04T03:00:00.000Z",
"start": "2021-08-04T02:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-04T04:00:00.000Z",
"start": "2021-08-04T03:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-04T05:00:00.000Z",
"start": "2021-08-04T04:00:00.000Z",
"tweet_count": 2
},
{
"end": "2021-08-04T06:00:00.000Z",
"start": "2021-08-04T05:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-08-04T07:00:00.000Z",
"start": "2021-08-04T06:00:00.000Z",
"tweet_count": 20
},
{
"end": "2021-08-04T08:00:00.000Z",
"start": "2021-08-04T07:00:00.000Z",
"tweet_count": 6
},
{
"end": "2021-08-04T09:00:00.000Z",
"start": "2021-08-04T08:00:00.000Z",
"tweet_count": 16
},
{
"end": "2021-08-04T10:00:00.000Z",
"start": "2021-08-04T09:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-08-04T11:00:00.000Z",
"start": "2021-08-04T10:00:00.000Z",
"tweet_count": 25
},
{
"end": "2021-08-04T12:00:00.000Z",
"start": "2021-08-04T11:00:00.000Z",
"tweet_count": 27
},
{
"end": "2021-08-04T13:00:00.000Z",
"start": "2021-08-04T12:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-08-04T14:00:00.000Z",
"start": "2021-08-04T13:00:00.000Z",
"tweet_count": 8
},
{
"end": "2021-08-04T15:00:00.000Z",
"start": "2021-08-04T14:00:00.000Z",
"tweet_count": 14
},
{
"end": "2021-08-04T16:00:00.000Z",
"start": "2021-08-04T15:00:00.000Z",
"tweet_count": 7
},
{
"end": "2021-08-04T17:00:00.000Z",
"start": "2021-08-04T16:00:00.000Z",
"tweet_count": 5
},
{
"end": "2021-08-04T18:00:00.000Z",
"start": "2021-08-04T17:00:00.000Z",
"tweet_count": 10
},
{
"end": "2021-08-04T18:34:20.000Z",
"start": "2021-08-04T18:00:00.000Z",
"tweet_count": 4
}
],
"meta": {
"total_tweet_count": 1941
}
}
Starting with the work of prototyping Twitter API call to query using hashtags. The API which could be used is the Twitter API v2 early access. We need to apply for a developer's account to be able to get the API keys, consumer keys and access tokens.