6

Anyone know if it's possible to grab all posts with an image, from the Twitter API? I know I can check all tweets for a media, but that's a bit slow process.

2 Answers 2

4

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, look for any media_url elements; those will contain the URL to any photos. It may contain video links, so you'll have to filter for common image types (.png/ .jpg/ .gif/etc).

0

As well as include_entities=true, you can use filter:images to request only tweets that include images. But that only seems to work on a search request, not a timeline request. Hope it helps anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.