How do I pull the twitter user name from the tweet using TweetStream?
in
Contributed Library Questions
•
2 years ago
I need to be able to pull the id or twitter user name from an incoming tweet. Right now I can call tweet.user() to get a String back with something that looks like "com.twitter.processing.User@dca7d0".
Is there any way to get the exact user id or username from a Status object?
For example, this is the callback used. At the bottom is the User object I assign tweet.user() to.
Is there any way to get the exact user id or username from a Status object?
For example, this is the callback used. At the bottom is the User object I assign tweet.user() to.
- void tweet(Status tweet) {
// store the latest tweet text
tweetText = tweet.text();
println("------------------------");
println("createdAt: " + tweet.createdAt());
println("favorited: " + tweet.favorited());
println("tweet id: " + tweet.id());
println("geo: " + tweet.geo());
println("inReplyToScreenName: " + tweet.inReplyToScreenName());
println("inReplyToStatusId: " + tweet.inReplyToStatusId());
println("inReplyToUserId: " + tweet.inReplyToUserId());
println("source: " + tweet.source());
println("text: " + tweet.text());
println("truncated: " + tweet.truncated());
User user = new User();
user = tweet.user();
println("user: " + user);
1