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

image
extended-tweet
links
urls

#1

Hello,
I am trying to use the twitter rest api for my deal website http://www.getbeststuff.com. 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.
788018362383073281
787974711523282945
For the first one, it returns the URL attached with the tweet (http://giveback.indyeleven.com) for

tweets["statuses"]["entities"]["urls"][0]["expanded_url"]

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: bit.ly/2e0GHaM 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?

Thanks


#2

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 dev.twitter.com (note that the replies changes described there have not yet been rolled out) - and this will be added across the endpoint documentation in future.


#3

thanks!