Segregating Twitter Streaming Response

I created a streaming query with 400 track keywords and 5,000 follows.
When I get a response from Twitter , how do I associate which follow/keyword triggered the response?
Some of the results seem to not make sense.
thanks

unfortunately, i think the only way to do this is on your end, twitter doesn’t supply what filter matched a tweet.

@Navneeth Do you happen to have a good heuristic to match a tweet to the search parameters?

I would check for user IDs first, and then lowercased and space split tweet text for intersecting keywords

Conceptually this is what I am doing. I have a good understanding of keyword/track match , with unicode normalization and such… but with usernames/follows its not that simple. According to Twitter the follows match with these rules:

1.Tweets created by the user.

2.Tweets which are retweeted by the user.

3.Replies to any Tweet created by the user.

4.Retweets of any Tweet created by the user.

5.Manual replies, created without pressing a reply button (e.g. “@Adri I agree”).
1-2 are trivial , 3-4 are more involved but doable , 5 I have no idea how to do.

Ah, ok:
1 and 2 are in the user object of the top-level tweet, like tweet[‘user’][‘id’]
4 is the inner-level tweet, retweeted_status - so tweet[‘retweeted_status’][‘user’][‘id’] should be one of your follow ids.
3 can be checked in in_reply_to_user_id field, or mentions.
5 and 3 can be checked together from the mentions: tweet[‘entities’][‘user_mentions’]
Additionally, if “truncated”: true you might have to dig into extended_tweet https://developer.twitter.com/en/docs/tweets/tweet-updates.html

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.