How to filter retweets and replies from Twitter User Stream using Twitter4j? -
i'm using twitter4j twitterstream.user() read timeline authenticated user. i'm interested in tweets users user follows. 99% of statuses stream retweets , replies of users user doesn't follow. i'm filtering them out maintaining list of user's following , checking each status against list, , in addition i'm checking status.getinreplytostatusid zero. works seems inefficient since 99% of data read filtered out. there way twitter4j instruct user stream send original tweets without retweets , replies?
it seems can filter replied tweets parameter, not sure if implemented in twitter4j. retweets think have filter out them manually.
from user stream api:
user streams messages
types of messages
there streaming messages not returned rest apis. see streaming message types information.
data accounts user follows
the parameter controls types of messages received. default user streams with=followings, gives data user , user’s followings (accounts authenticated user follows). setting with=user sends events user, , not events followings.
replies
by default @replies sent mutual followings. @replies followings can enabled replies=all parameter. example, if alice follows bob, alice doesn’t follow carol, default if bob @replies carol, alice not see tweet. default behavior mimics twitter.com , api.twitter.com behavior. if application wishes display @replies, or filtered subset of @replies, use replies=all.
direct messages
direct messages still require proper permissions. see application permission model.
Comments
Post a Comment