-1

How can I create a twitter search query for multiple accounts based on multiple words? For example: Consider two accounts: @hero1 and @hero2. I want all tweets from hero1 containing words 'super' or 'action' and tweets from hero2 containing word 'enemy' or a hashtag '#great'. How can I achieve this in one search query. I am able to search for a single account and single keyword but the multiple case is not working. Any help would be appreciated. Thanks in advance! Currently my api call looks like:

https://api.twitter.com/1.1/search/tweets.json?q=from%3Ahero1+super+action&count=10&include_entities=true
Phoenix Dev
  • 457
  • 5
  • 19
  • Can you show us the code that you've written so far? – Terence Eden Jul 06 '17 at 09:06
  • @TerenceEden I have updated the question with a sample call I am using. – Phoenix Dev Jul 06 '17 at 09:37
  • Your code only shows you searching for `from:hero1 super action` – Terence Eden Jul 07 '17 at 05:32
  • @TerenceEden https://api.twitter.com/1.1/search/tweets.json?q=from%3Ahero1+super+action+AND+from%3Ahero2+enemy+#great&count=10&include_entities=true . This is what I was trying to do, but its not working, to be exact, I dont know if this is the correct way to achieve what I need. Any help? – Phoenix Dev Jul 07 '17 at 13:19

1 Answers1

1

The advanced search doesn't allow the sort of query that you want in a single request.

You will have to call two separate searches:

super or action from:hero1 and the enemy or #great from:hero2

Terence Eden
  • 14,034
  • 3
  • 48
  • 89
  • Oh! Actually these account handles and words are to be dynamically added from backend and therefore there will be multiple data and now it seems I will have to call it in a loop. Too sad! Anyways thanks mate! – Phoenix Dev Jul 10 '17 at 06:11