0

I have a list of twitter user_ids. I want to get the most recent tweet of each of them.

There is a search/tweet.json api in which you can give multiple user ids separated by OR as follows:

https://api.twitter.com/1.1/search/tweets.json?q=from%3ATwitterEng%2BOR%2Bfrom%3ATwitter&result_type=recent

This query finds the recent tweets from TwitterEng or Twitter user_ids.

Now, there is a possibility that the API returns only the tweets from TwitterEng since those were more recent.

How do I ensure that I get one tweet from both the users?

There is the user_timeline API that will give the tweet for the given user_id. But I have a lot of user_ids and cannot make calls to this API for all those ids.

Is there a way of achieving this?

Thanks in advance for your replies

Lavanya Mohan
  • 1,496
  • 7
  • 28
  • 39

1 Answers1

0

Try this ;)

There are two ways to get recent tweets of multiple users:

  1. Get all tweets and filter for the users you want to get the tweets form;
  2. Get tweets for individual user and use the recent tweets based on the tweet posted; with this case you can also mention the from and since parameters while querying twitter api to get tweets between this time bound;

There is no direct endpoint to get recent tweets for multiple users;

itzmukeshy7
  • 2,669
  • 1
  • 21
  • 29
  • The problem with getting tweets for individual users is that there are limits to the number of request (example 300 requests in 15minute window). I might have more than 300 users. Also, there are similar limitations in getting all tweets as well. – Lavanya Mohan May 05 '16 at 05:13
  • To remove limits to the number of request (example 300 requests in 15minute window) you can use multiple apps and access tokens; – itzmukeshy7 May 05 '16 at 05:56