3
votes

I am getting tweets of a user but not getting media_url under entities in right twitter object returned, even nothing in media in the API call. For testing i used this user twitterapi (https://twitter.com/twitterapi), my API call includes all needed parameters like consumer key to access secret as i saw by debugging my php application.

But when i test in API console putting this url https://api.twitter.com/1.1/statuses/user_timeline.json?count=10&screen_name=twitterapi, i see entities.media.media_url field and value.

where is wrong, is there any permission missing?

3
We might need to see the actual response JSON. You can paste response in your question. - Arfeen

3 Answers

1
votes

Tweeter changes API for large text tweets, you have to add the "tweet_mode" parameter to any request.

https://developer.twitter.com/en/docs/tweets/tweet-updates

GET /1.1/statuses/show.json?id=123&tweet_mode=extended HTTP/1.1
-1
votes

The tweet may fall in one of three categories:

  1. No media - For a text-only tweet, there simply will not be a media_url entry under the entities key.
  2. Single media - There will be a media_url entry under the entities key.
  3. Multiple media - There will be 1 or more entries with media_url keys under the extended_entities key. In this case there may also be a media_url entry under entities as well.

If you handle all three cases, you should get the proper results. To make things easier on yourself, take your json results and dump them into an online viewer like http://www.jsoneditoronline.org and you should be able see the structure clearly.