Retrieving photos from Twitter / user_timeline statuses

Using the Twitter API, I can get all user tweets with location information. If they use a mobile application and attach photos, how can I get this from the API?

+7
source share
1 answer

First of all, you need to include include_entities=true as part of the request:

i.e. https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter&include_entities=true

Then find any media_url elements; they will contain the url for any photos. It may contain video links, so you have to filter out common image types (.png / .jpg / .gif / etc).

See: Tweet Objects

+7
source

All Articles