Get tweets from twitter using twitter4j

I am developing an application to guess tornado locations by analyzing twitter data. To do this, I would first need to train the neural network in some annotated tweets. I’ve been trying to get tweets from last year that have the word β€œtornado” in it. This is my code below: -

Query query = new Query("tornado"); query.setRpp(100); query.setSince("2010-11-01"); query.setUntil("2011-01-13"); QueryResult queryResult = instance.search(query); tweetList = queryResult.getTweets(); 

I can get tweets from periods closer to the present, for example, last week, etc., but I can not get any results for periods like the ones listed above. Any hints, suggestions are help. Thanks in advance.

+4
source share
1 answer

I just figured out the reason using another means, thought that I would share the answer in case there are other people with the same problem.

It turned out that the twit-search api does not return tweets older than about a week, and also, depending on the load on the server, from time to time it can be only 24 hours! Therefore, any third-party libraries (such as twitter4j) that have a wrapper for the twitter search api will behave in a similar way.

The best way to do this is to use third-party search and indexing sites like snapbird, topsy, etc.

+6
source

Source: https://habr.com/ru/post/1379241/


All Articles