I am trying to query the Twitter Search API for either a user, several users, a hashtag, several hashtags, or any combo of them. I am struggling with the syntax.
Multiple users (WORKS)
?q=from:user1 OR from:user2 OR from user3
Single hashtag (WORKS)
?q=with:#hashtag
Combo (BROKEN)
?q=from:user1 OR from:user2 OR with:#hash1 OR with:hash2
//returns most recent tweets and ignores my query altogether. No error
I do not want to query a specific hashtag from a specific user. I want either/or results. If I use the following syntax, it works, but it also searches the contents of the tweet, as opposed to just the hashtag, which is not as nice.
Contains search (WORKS)
?q=from:user1 OR hashtag1 OR hashtag2
Is there any way to accomplish what I am looking for or no? I have also tried the following
(BROKEN)
?q=from:user1 OR from:user2 OR with:hash1 OR hash2 OR hash3
Hope this make sense. I can clarify further if needed. (Note: I am using since_id and max_id in my actual environment, as well as rpp, but for the ease of this question, I left them out of my examples.)
This answer was written in 2013. The API it uses has since been retired. It is kept for historical interest only. For Twitter API authenticated requests are now required now.
During same research i found to search with multiple hashtags in API V1.1. you can do like
http://search.twitter.com/search?q=#hashtag1+OR+#hashtag2
http://search.twitter.com/search?q=#hashtag1+AND+#hashtag2
AND/OR will be caps and not forgot to values URL encode. for more detail you can look here https://dev.twitter.com/docs/using-search