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
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).
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.