Search tweets API returned empty statuses result for some queries


#1

For some twitter accounts, API always return empty statuses result.
For example:
api.twitter.com/1.1/search/tweets.json?q=@steppe_fox - will return empty result (but i have a tweets) in statuses json field
api.twitter.com/1.1/search/tweets.json?q=@Dropbox - works fine


#2

Are you encoding the “@” symbol while writing your queries? Are you looking for tweets authored by the accounts in question or about the accounts? It is better to use statuses/user_timeline to retrieve tweets authored by a specific user.

Also, not all tweets appear in search results.
[faq:8650]


#3

Hi,

I have totally the same problem. I am trying to get twitts from the following channel names: XX and XX_XX with the following results:

https://api.twitter.com/1.1/search/tweets.json?count=1&q=from%3AXX_XX => always returns empty statuses json while
https://api.twitter.com/1.1/search/tweets.json?count=1&q=from%3AXX => works fine

I have tried to encode “_” without any positive results and I do not use @


#4

I’m dealing with the same issue. Here’s a side by side comparison of the query I’m running on twitter’s web search versus the result I get when I curl https://api.twitter.com/1.1/search/tweets.json?q=“pakistan%20began%20three%20days%20of%20mourning%20wednesday”:

{“statuses”:[],“search_metadata”:{“completed_in”:0.011,“max_id”:555038977825464320,“max_id_str”:“555038977825464320”,“query”:"%22pakistan+began+three+days+of+mourning+wednesday%22",“refresh_url”:"?since_id=555038977825464320&q=%22pakistan%20began%20three%20days%20of%20mourning%20wednesday%22&include_entities=1",“count”:15,“since_id”:0,“since_id_str”:“0”}}

There’s no oauth error, my status is ok, and changing the format of my query (removing double quotes, replacing ascii codes, etc.) doesn’t help. I’ve tried using fewer keywords. q=pakistan works, q=pakistan+began works, but as soon as I add a third keyword (e.g. q=pakistan+began+three), I no longer get any hits.

not all tweets appear in search results.

We need more info on this.


#5

Hi there!

This does seem strange.

Regarding underscores/@ symbols, I tested with @Harry_Styles, and it returned a number of results. So I’m thinking it’s not related to special characters formatting.

https://api.twitter.com/1.1/search/tweets.json?q=@Harry_Styles

At this point, I think it’s likely because the API search isn’t guaranteed to return all results. The web search has had a recent overhaul. Currently, there is no timeline for those changes to be brought to other parts of our system.and we’re looking to bring those improvements to other parts of the system.

Thanks!


#6

Hi there!

Thanks for all the activity and building on the Twitter platform. We really appreciate it!

Regarding web vs. API search, we’re aware that the two return different results at the moment. We made upgrades to the web search. There is no timeline for those changes to be brought to other parts of our system.

I tried your query terms, and also got no results. I also tried adding quotes around it as a single term, and no luck either. So I’ll certainly ask the eng team and follow up here.

I know it may not be a ton of help, but if you are building for your company/commercial purposes, we might suggest using GNIP search to do many of the things you might be trying to do. (It is a paid product, so that may be a barrier to usage.)

Again, we really appreciate it, and will post here when we have updates!


#7

Oh, I also forgot to mention, if you’re looking for tweets from a user or @mentions of that user, I would suggest the following two APIs:

https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline
https://dev.twitter.com/rest/reference/get/statuses/user_timeline

They may accomplish what you’re looking for.

Let us know if this helps!


#8

Thanks a lot for the response, Ryan. We’re looking into GNIP for later builds on our platform.


#9