Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Search API multiple hash tags or users

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.)

like image 558
Chris Avatar asked Sep 15 '12 20:09

Chris


People also ask

Can I search multiple tags on Twitter?

Searching for multiple hashtags on Twitter is very simple. Use the search bar and type two or more hashtags you want to find. You will find tweets that contain them. Also, Twitter allows us to search hashtags through Advanced Search.

What is the limit of Twitter's search API?

The default per-minute rate limit for Full-Archive search is 120 requests per minute, for an average of 2 queries per second (QPS). This average QPS means that, in theory, 2 requests can be made of the API every second.

How do you search multiple hashtags on Tweetdeck?

To list multiple hashtags use the Boolean operator of “OR” in between the hashtags.


1 Answers

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

like image 145
Govind Totla Avatar answered Sep 29 '22 15:09

Govind Totla