java - twitter4j - Count the number of tweets within 24 hours, return an integer -


I am trying to retrieve an integer of a certain keyword's tweet within 24 hours. So say that the keyword is "traffic", I want to count the number of tweets in the last 24 days with the word "traffic", and want to store it as the number used to generate other things.

Right now, I can provide a specific number using query.setCount and I can get an arbitrary number (1024) tweets in the last 24 hours, but there is no way to tell me that It has all tweets within 24 hours, I really have a number, I do not need actual text or other information about tweets. Besides, as new tweets arrive, you can update that number.

How can I go about doing this?

Even my getNewTweets method is:

  zero getNewTweets () {simple data formatting SDF = new SimpleDefform ("YMD"); Calendar Calendar = Calendar.getInstance (); Calendar.ed (calendar.HOUR_OF_DAY, -24); String tomorrow = sdf.format (calendar.getTime ()); Query query = new query ("traffic"); Query.setSince (tomorrow); Int numberoffithms = 1024; Long last = lang.mx_avn; While (tweets.size () & lt; numberOfTweets) {if (numberOfTweets - tweets.size ()> 100) query.setCount (100); Else query.setCount (numberOfTweets - tweets.size ()); Try {QueryResult Result = twitter.search (query); Tweets.addAll (result.getTweets ()); Println ("Collect" + tweets.size () + "Tweets"); For (Position T: Tweets) If (TGID ()  

You can not tell the precise count of Tweets for specific filters / search queries The API rates are limited, you will have to use the fireshoes to get all the tweets data and it is paid.

Below is a partial form of Twitter Dev -

Before joining it, it is important to know that Search API is focused on relevance and Not absolute, this means that some tweets and users may disappear from search results. If you want a match for completion, you should consider

instead of using the streaming API; Please read the following link to understand more on limiting the streaming API rate -


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -