Tweepy - How to "tag" tweets with their respective tracking filter
<p>I'm having a hard time formulating my question, but basically, imagine you're streaming Twitter with Tweepy and filtering the tweets on 2 keywords like that:</p>

<pre><code>twitterStream = Stream(auth, listener())
twitterStream.filter(track=["keyword1", "keyword2"])
</code></pre>

<p>Basically, I would like to append the keywords on their respective tweets, so, for example, I would get something like this:</p>

<pre><code>some tweet about keyword 1 [keyword1]
another tweet about keyword 1 [keyword1]
some tweet about keyword 2 [keyword2]
etc...
</code></pre>

<p>Is this possible?</p>

<p>Thanks!</p>

<p>Tweepy use twitter streaming API, from docs of <a href="https://dev.twitter.com/streaming/overview/request-parameters" rel="nofollow">streaming API</a>, I believe its impossible to get result as you expected. Possible solutions are: </p>

<ol>
<li>If you have very limited keywords to track, then for each of these keywords, make a streaming track request.</li>
<li>If you have lots of keywords to track, and you track all of these keywords in one streaming request, then you can perform keyword search on the returned tweets to determine what keywords this tweets containing. Depending one your applications, the search operation may process on many fields of tweet, e.g., text, hashtag, urls and etc.</li>
</ol>

<p>Hope this would be help for. Thanks.</p>

python twitter tweepy