xdevplatform / Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
Apache License 2.0
2.65k stars 984 forks source link

[BUG] `GET /2/tweets/:id` not returning tweet url for some/many tweets #101

Closed hosseinkalbasi closed 2 years ago

hosseinkalbasi commented 2 years ago

Describe the bug This is an issue with the Twitter API V2, which I have noticed that for many tweets it does not return the url mentioned in the tweet or as part of the attached media.

To Reproduce Try finding tweet details for the following tweet: 1537477582194626560 (accessible via https://twitter.com/961227801365008385/status/1537477582194626560). This will give you correct results (url included)

Now do the same for the following tweet: id: 1559108202666397696 accessible via https://twitter.com/961227801365008385/status/1559108202666397696. Although the tweet has a url, the API will NOT return it.

Expected behavior API response matches what we see in the tweet via the link and tweet URLs are returned properly.

Additional context I could confirm this issue via the Live Request of Twitter API dashboard as well as with Python client.

hosseinkalbasi commented 2 years ago

It will be resolved by adding the expansions=referenced_tweets.id to the API call so that urls of reference tweets are also included.