Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Client.get_users_tweets() exclude=replies but returned reference_tweets.type=replied_to #2069

Open
ranggakd opened this issue Feb 14, 2023 · 2 comments
Labels
API This is regarding Twitter's API

Comments

@ranggakd
Copy link

well from today and now on I expect a lot of changes in Twitter API v2, but is there any explanation for this?

my code is as follows:

import tweepy as tw
import configparser.ConfigParser(interpolation=None)
config.read(CONFIG)
bearer_token = config['twitter']['bearer_token']
client = tw.client(bearer_token=bearer_token)

problem start here

test = client.get_users_tweets(735358344106549248,
                        exclude='replies',
                        max_results=5,
                        tweet_fields=['public_metrics','created_at'],
                        expansions='referenced_tweets.id.author_id')
for t in test.data:
    if getattr(t, 'referenced_tweets'):
        print(t.referenced_tweets[0].type)

it returns

replied_to
quoted
quoted

I expected replied_to would never be returned since it was exclude by the func parameter

@Harmon758
Copy link
Member

This is a bug with Twitter's API where using exclude=replies with the GET /2/users/:id/tweets endpoint doesn't exclude replies to the user's own Tweets.

I was made aware of the bug through a support post in the Tweepy Discord server and reported the bug to Twitter back in November. The developer advocate I reported it to said they confirmed the bug and reported it, but they no longer work there now, so I don't really have a means to follow up on it.

@Harmon758 Harmon758 added the API This is regarding Twitter's API label Feb 14, 2023
@ranggakd
Copy link
Author

thank you for clarifying the issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This is regarding Twitter's API
Projects
None yet
Development

No branches or pull requests

2 participants