Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter4J: Get all statuses from Twitter account

Tags:

twitter

api

I'm using Twitter4J API for my application. I want to get all the statuses I had on my Twitter account (or if not all, most of them). Is this possible? Currently I am using getUserTimeline() but this only retrieves the last 20...

Thanks a lot and regards,

Krt_Malta

like image 873
Krt_Malta Avatar asked Dec 18 '22 02:12

Krt_Malta


2 Answers

// retrieves the first page's 200 tweets
getUserTimeline(new Paging(1, 200));
like image 106
Krt_Malta Avatar answered Dec 19 '22 15:12

Krt_Malta


Twitter doesn't allow searching for all the tweets (they are expired), so you'll only be able to query as far back as Twitter allows.

From Twitter

We also restrict the size of the search index by placing a date limit on the updates we allow you to search. This limit is currently around 1.5 weeks but is dynamic and subject to shrink as the number of tweets per day continues to grow.

like image 38
Andy Avatar answered Dec 19 '22 14:12

Andy