Processing
 

How to listen to thousands of twitter accounts simultaneously?

25/08/2016 18:19#1

Joined at: 4 months ago

Post: 1

Thank: 0

Thanked: 0

I am in the process of building an app that will monitor multiple Twitter accounts(~10K) for their most recent activities and perform some analysis based on that. I am able to create a listener for one such twitter account and do the processing through the streaming API provided by Twitter4j. However, I am not able to figure out how to replicate this model for thousands of accounts in parallel. Tried looking for it over the web but could not find any satisfactory answer. Is it actually achievable? Or do I need to think of some other approach? Any help would be highly appreciated.

Thank you!

26/08/2016 18:07Top#2

FeanDoe

Member

Joined at: 7 months ago

Post: 24

Thank: 0

Thanked: 0

If you want to follow some users you should use a filter. The Twitter Api let you follow up to 5000 users by their id with one credential, like this:

StatusListener statusListener = new StatusListener() {     @Override     public void onStatus(Status status) {         //your code to manage the statuses     }     //other requiredly-overriden methods } ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.setOAuthConsumerKey("XXXXX"); configurationBuilder.setOAuthConsumerSecret("XXXXXXX"); TwitterStream twitterStream = new TwitterStreamFactory(configurationBuilder.build()).getInstance(new AccessToken("XXXXX", "XXXXXXX")); twitterStream.addListener(statusListener);  //from here is different at your code  //you need to set up your user list, with their users id's! long[] userslist = YOUR USER LIST; //then you create a filter FilterQuery filtre = new FilterQuery(); //and use that filter to follow the users that you want and to start the stream filtre.follow(userslist); twitterStream.filter(filtre); 

With the filter you could follow up to 5000 different users and you will get what they tweet, when they are being retweeted and when they are being mentioned.

Similar articles

How do twitter giveaways work?

8 months ago - Reply: 2 - Views: 126

How may I get genuine followers on Twitter?

3 years ago - Reply: 33 - Views: 1,828

Login to Twitter sometime fail

6 months ago - Reply: 1 - Views: 23

Twitter doesn't accept PHP's cURL, but Linux'

1 year ago - Reply: 2 - Views: 90

Twitter OAuth on iOS

5 months ago - Reply: 1 - Views: 92

why am i getting an error on .verifyCredentials()

5 months ago - Reply: 1 - Views: 35

TwitteR setup_twitter_oauth() gives an error

5 months ago - Reply: 1 - Views: 29

Tweepy - Getting the author of a retweeted tweet

5 months ago - Reply: 0 - Views: 4

Retrieving data from twitter with JavaScript

5 months ago - Reply: 0 - Views: 2

Combined social media feed returning the wrong data

5 months ago - Reply: 0 - Views: 0

Django and Twitter request_token

5 months ago - Reply: 0 - Views: 0

Python HMAC hashed value encoding to base64

5 months ago - Reply: 1 - Views: 32

At the rate symbol in facebook

5 months ago - Reply: 0 - Views: 1

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re