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

Tweets don’t always found from direct messages #32

Open
steven-douilliet opened this issue Dec 12, 2022 · 1 comment
Open

Tweets don’t always found from direct messages #32

steven-douilliet opened this issue Dec 12, 2022 · 1 comment

Comments

@steven-douilliet
Copy link

Context

Twitter API version : v2

Endpoint : GET /2/dm_events

Library : Tweepy library

I want to retrieve the tweets from direct messages sent by participants.
Below my code :

tweepy.Paginator(
    client.get_direct_message_events,
    max_results=100,
    limit=3,
    expansions=[
        "sender_id", "referenced_tweets.id", "participant_ids"
    ],
    user_fields=[
        "id", "username", "name"
    ],
    dm_event_fields=[
        "id", "created_at", "dm_conversation_id", "attachments",
        "participant_ids", "sender_id", "referenced_tweets"
    ],
    tweet_fields=[
        "id", "author_id", "created_at", "entities"
    ]
)

The issue

I specify that the following issue is not present on Twitter API v1 (I checked).

When a participant sends a tweet link, it can be shows in two ways :

  1. The link is displayed and shows a preview (if not sensitve) and this is included as referenced tweet :
{
    "dm_conversation_id": "123456789-987654321",
    "created_at": "2022-12-11T00:05:23.000Z",
    "referenced_tweets": [
        {
            "id": "160003..."
        }
    ],
    "sender_id": "123456789",
    "text": "(...) https://t.co/dl... (...)",
    "id": "160172982...",
    "event_type": "MessageCreate"
}
  1. Sometimes the link is displayed twice and no tweet is found whereas a tweet URL is present:
{
    "created_at": "2022-12-11T00:12:18.000Z",
    "id": "123456789",
    "text": "(...) https://t.co/Cq... https://t.co/7z... (...)",
    "sender_id": "133712...",
    "event_type": "MessageCreate",
    "dm_conversation_id": "123456789-987654321"
}
@igorbrigadir
Copy link
Contributor

Sometimes the link is displayed twice and no tweet is found whereas a tweet URL is present:

Just to clarify this via https://twittercommunity.com/t/tweets-dont-always-found-from-direct-messages/181433

A good example of this is when 2 tweet links are included. The referenced_tweets are empty, when the expected results are both linked tweets in referenced _tweets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants