Can't get the URL on tweets that have an image



I am trying to use the twitter rest api for my deal website I did a search for the following keyword using the API:
promo code filter:verified filter:links

Now check out these two different statuses that it returns.
For the first one, it returns the URL attached with the tweet ( for


which is fine.

But for the second one(which has an image attached), for the same tweets["statuses"]["entities"]["urls"][0]["expanded_url"] it returns the URL to the tweet with the id 787974711523282945

Why is that? How can I get the attached url: from the second tweet?

There are no keys in that whole json which has that link. Why is that? How can i get that link using the api?



In the latter case, the truncated field for that Tweet shows that it is truncated i.e. this Tweet is in compatibility mode, which is the default for the REST API. Calling the API again with tweet_mode=extended shows the whole Tweet in the new extended Tweet format. The first Tweet is not truncated.

Documentation on this is in the new extended Tweets page on (note that the replies changes described there have not yet been rolled out) - and this will be added across the endpoint documentation in future.