Getting media only from logged in user timeline from Twitter API [Ask]

media
fabric
twitterkit
api

#1

Hi, I wanted to get all user media, especially images, that posted by the current logged in user. We can do that by using statuses/user_timeline api, and then we can filter which post is an image. As I know, that API currently limited up to 200 posts response per request. In some cases, it maybe can contain some post that is an image, or in worst case, there’s no image in that 200 posts.

If there’s an user, that rarely tweeting image, and he/she only tweeting image after 2000 posts, how to handle that? Am I must request to that api 10 times, or there’s a simple solution? If I must request 10 times, then I must digging into all of he/she post to get all image, isn’t it?
Thank you before.

edit: Also, we can use the search/tweets.json and use filter:images. But if that user’s tweet is private, the statuses entity always empty.
Correct me if I’m wrong.


#2

I don’t think there is a good solution for this, probably searching is the best way to do it.
I am not aware of an ability to filter the user_timeline for Tweets that only contain media.


#3

Unfortunately, using search API only contain tweets for last 2 weeks.
We need to fetch all photos that posted by logged in user (for implement pick picture from social medias, twitter is one of it).

The only thing that can I do now is

  1. Getting user’s total tweet.
  2. Fetching user’s timeline per 200 item, and add to a temporary media list for a tweet that contain media object.
  3. If the temporary media list below 20 and the timeline page is below user’s total tweet, back to step 2. If the list >= 20, then add it to media list.

It’s not perfectly solution, but maybe it can help others.


#4

Getting all media is impossible, even with what you described.
The user timeline will give you only up to the last 3200 Tweets, not more.
So if the user posted more than that, you can’t get media older than the 3200. Tweet.