1

I can search a tweet with many keywords, but when I try to search users with many keywords, it just does not return any thing (for loop is skipped)

searchQuery = 'tokyo' OR 'osaka' OR 'london'
for target in tweepy.Cursor(api.search_users,q=searchQuery).items(1000) :

So it is impossible to search users with many keywords?

John
  • 3,888
  • 11
  • 46
  • 84

1 Answers1

0

According to the Twitter Search API, the q parameter takes a max of 500 characters, which limits the number of parameters. The docs also state that q has a complexity limit, which is undefined. What you can do is experiment with the number of parameters to get a general idea of where the complexity limit is for your use case. This won't guarantee not hitting the limit, but could lead to a mitigation technique to avoid the problem.

Another thing is to double-check that your problem isn't compounded by rate limits, which I discuss in another SO post, How rate limit works in twitter in search API.

Also, the Standard Search API only goes back 7 days and is limited to relevance, which is undefined.

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60