I use twitter4j library to access the public twitter stream. I am trying to create a project using geotagged tweets, and I need to collect a large number of them for testing.
Now I get unfiltered stream from twitter and save only tweets with geotags. This is slow because most VAST tweets do not have geotags. I want the twitter stream to send me only geotagged tweets.
I tried using the method mentioned in this question where you filter with a 360 * by 180 * bounding box, but this does not work for me. I don't get any errors when using this filter, but I still get 99% of the tweets without geotags. Here is how I do it:
ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey("censored") .setOAuthConsumerSecret("censored") .setOAuthAccessToken("censored") .setOAuthAccessTokenSecret("censored"); TwitterStream twitterStream = newTwitterStreamFactory(cb.build()).getInstance(); StatusListener listener = new MyStatusListener(); twitterStream.addListener(listener);
Any suggestions on why I still get tweets without geotags?
Edit: I just re-read twitter4j javadoc about adding filters to the twitter stream and it says: "The default access level allows up to 200 keywords, 400 follow user pointers and 10 boxes with 1 degree." So, bounding boxes can only be 1 degree wide? This is different from the original information I came across. It is my problem? My filter request is too large, why is it ignored? I do not get any errors when trying to use it.
source share