Getting custom tweets via twitter API does not return media_url

I get user tweets, but I don’t get media_url under objects in the object with the correct twitter, even nothing in the media in the API call. For testing, I used this twitterapi (https://twitter.com/twitterapi) user twitterapi (https://twitter.com/twitterapi) , my API call includes all the necessary parameters, such as a consumer key, to access the secret, as I saw when debugging my php application.

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

where not so, is there any permission?

+1
source share
2 answers

Twitter can fall into one of three categories:

  • No media files. For a text tweet, there simply will not be a media_url entry under the entity key.
  • Single carrier. There will be a media_url entry under the entity key.
  • Several carriers. In the extended_entities section, 1 or more entries with the media_url keys will be added. In this case, there may also be a media_url entry under the objects.

If you handle all three cases, you should get the right results. To make your task easier, take your json results and upload them to an online view, for example http://www.jsoneditoronline.org , and you should be able to see the structure clearly.

0
source

Source: https://habr.com/ru/post/909519/


All Articles