Reputation: 5444
I have created a twitterStream in twitter4j java Api, with which I want to track down user's status. I got a list of users which is actually the followIDs. In listener actually I download user's status images. I save my images with the following name:
String ImageUniqueFileName = status.getUser().getId()+"_id_"+CreateUniqueFileName();
ImageUniqueFileName = ImageUniqueFileName + ".jpg";
I ve noticed that in saved images, I got several user ids which was not in the initial list followIDs. Is it normal that I track down ids from other users? Second question, how is it possible to track down not all user tweets but just the last 200 user tweets in twitterStream?
TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
twitterStream.addListener(listener);
FilterQuery fq = new FilterQuery();
// fq.track(myQueries);
fq.follow(followIDs);
twitterStream.filter(fq);
ArrayList<FilterQuery> list = new ArrayList<FilterQuery>();
list.add(fq);
Upvotes: 1
Views: 162
Reputation: 20375
Using the follow
parameter will result in the following Tweets being matched:
- Tweets created by the user.
- Tweets which are retweeted by the user.
- Replies to any Tweet created by the user.
- Retweets of any Tweet created by the user.
- Manual replies, created without pressing a reply button (e.g. “@twitterapi I agree”).
I think you assumption is correct, this may account for the unknown ids.
Regarding obtaining the user's Tweets, you won't be able to use the streaming api for that as it's a real time view of Twitter. However, you may be able to use getUserTimeline(userId, paging)
to retrieve the Tweets.
For a simple example of getUserTimeline
in action, take a look at the GetUserTimeline
example.
Upvotes: 1