Question

Can I get all the tweets of a particular user, in which a particular hashtag is used?

I could just get the past 100 tweets then filter them on my end, but it would be much more convenient if Twitter could do the filtering on their end.

Is this possible?

Was it helpful?

Solution

Twitter's Advanced Search lets you construct the query you desire. Unfortunately, search results only seem to be for tweets posted within the past 24 hours or so right now; might just be a temporary limitation, not sure.

In any case, your request URL might look something like this (note the JSON and Atom types):

http://search.twitter.com/search?q=%23HASHTAG+from:USERNAME http://search.twitter.com/search.json?q=%23HASHTAG+from:USERNAME http://search.twitter.com/search.atom?q=%23HASHTAG+from:USERNAME

But with the current timeframe limitation, it's not very practical.

OTHER TIPS

I am reading the twitter documentation and they say right now it will include only 6-9 days of tweets. Link https://dev.twitter.com/docs/using-search

To do this search against v1.1 of Twitter's API (which requires OAuth), you'd issue a GET request to the a URL structured like:

https://api.twitter.com/1.1/search/tweets.json?q=from:whitehouse+#sotu

See their Search API's "How to build a query" section. You'll be constrained to tweets over the last 7 days, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top