Consider this code snippet who's task is to display the first page of
a user's tweets:
const double tweetsPerPage = 20;
string screenName = "Dimebrain";
double updatesCount = 821;
double pages = updatesCount / tweetsPerPage;
int last = (int)Math.Floor(pages) - 1; // seek to the last
"full" page
string query = string.Format(
"http://twitter.com/statuses/user_timeline.xml?
screen_name={0}&page={1}", screenName, last);
In this example I would expect that I would actually be asking for the
last page of full tweets (not including the one getaway tweet #821).
But the end result here is I'm asking for page 40, or 40 x 20 = tweets
780 - 800. I'm still missing the final 21. If I try to request page
41, assuming this would give me tweets 800-820, and page 42 gives me
the final tweet, both of these page requests return an empty
collection.
Does total status count include deleted tweets? Is the page parameter
0-based rather than 1-based? I'm assuming neither based on the docs,
so wonder what else is preventing this algorithm from succeeeding in
fetching the first page of a user timeline. It works much worse on
accounts with many more tweets than mine.