Michal
Michal

Reputation: 5220

Twitter exclude_replies=true count=5 not returning 5 tweets

How do I return specific number of tweets without replies?

https://github.com/thujohn/twitter/issues/4

I found this answer on github but it is not helpful at all. Should make request to API in a while loop until i get 5 tweets? Really?

Thank you for your help.

These are my params: const params = { lang: 'en', count: 5, // I want exactly 5 tweets user_id: 12312312, screen_name: 'somescreenname', tweet_mode: 'extended', // I need media exclude_replies: true, // I DO NOT want replies include_rts: 1, // I want retweets from the user }

Upvotes: 0

Views: 565

Answers (1)

pii_ke
pii_ke

Reputation: 2891

In twitter API timeline requests, for example user timeline, replies are removed after count tweets are selected.

Using exclude_replies with the count parameter will mean you will receive up-to count tweets — this is because the count parameter retrieves that many Tweets before filtering out retweets and replies.

I would suggest you to use a larger count (upto 200 is allowed) and select first five tweets from the response.

Upvotes: 1

Related Questions