python-twitter icon indicating copy to clipboard operation
python-twitter copied to clipboard

GetUserRetweets & GetReplies don't properly filter UserTimeline

Open jeremylow opened this issue 8 years ago • 1 comments

As it stands, GetUserRetweets and GetReplies don't filter out tweets in the GetUserTimeline endpoint to properly only return retweets and replies, respectively. So GetUserRetweets returns the UserTimeline including retweets, but also returns regular tweets made by the authenticating user.

jeremylow avatar Apr 13 '17 11:04 jeremylow

According to the code:

  • include_rts (bool, optional): If True, the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets.
  • exclude_replies (bool, optional) If True, this will prevent replies from appearing in the returned timeline. 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. This parameter is only supported for JSON and XML responses.

So you can use:

timeline = api.GetUserTimeline(screen_name=screen_name, include_rts=False, exclude_replies=True)

DaWe35 avatar May 27 '21 07:05 DaWe35