Marwan Ze
Marwan Ze

Reputation: 69

need to get url attached to the tweet (status)

When I try to get the tweet (status) using this API endpoint https://api.twitter.com/1.1/statuses/show.json?id= the entities object which have urls does not provide me the link posted with the status, in the urls object there is only the tweet url itself.

example https://twitter.com/i/web/status/1148391479490043910

in this status there is an attached url

https://www.realitytvworld.com/news/tyler-cameron-13-things-know-about-the-bachelorette-star-hannah-brown-bachelor-tyler-cameron--26081.php

the shortest one is

https://t.com/LtkuldDijy

I need to get this url mentioned above in the urls subobject of entities object

Does anyone face this issue?

Upvotes: 0

Views: 305

Answers (2)

Marwan Ze
Marwan Ze

Reputation: 69

after a ton of searches and tries, I got the reason

the issue was because of the truncate issue of the tweet itself, so when request twitter API, must add 'tweet_mode=extended' to the request and everything work perfectly !

Upvotes: 0

JeffProd
JeffProd

Reputation: 3148

JSON Tweet in console

The long url is in thejson.entities.urls[0].expanded_url

The short one is in thejson.entities.urls[0].url

Upvotes: 1

Related Questions