简体   繁体   中英

I can't track my own tweets using the twitter4j library

I am developing an application able to track some keywords from Twitter. So far I have created a FilterQuery and passed it to my TwitterStream in this way:

FilterQuery filterQuery = new FilterQuery();
filterQuery.track(new String[]{"foo1", "foo2"});
twitterStream.addListener(this)//This code is inside a class that implements StatusListener
twitterStream.filter(filterQuery);

If I put a breakpoint inside the onStatus method of the class I can see that I get many posts talking about foo1 and foo2 from different people. The problem is that if I tweet a post from my own account containing the word "foo1" or "foo2" I dont get anything. Why?

Because my tweets were protected. In order to make them public I went to Settings and Privacy -> Privacy and Safety and unchecked the Protect your Tweets options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM