I hope I’m overthinking this and there’s an obvious solution.
From the API (GET statuses/user_timeline)
max_id – Returns results with an ID less than (that is, older than) or equal to the specified ID.
“or equal to” means it will include the tweet with ID that I sent as my max_id parameter.
—
My question is this: if I store the id of my oldest tweet (from a previous request), how can I subtract 1 from this id to exclude it from being returned in my next request?
The obvious solution would be to do something like this ‘&max_id=’+lastID-1, but twitter IDs are way to large for such math operations and javascript rounds off the results.
Details about the snowflake update:
https://dev.twitter.com/docs/twitter-ids-json-and-snowflake
Posible solutions:
It has been mentioned that I can use the BigInteger Javascript Library: http://silentmatt.com/biginteger/, but in my opinion this is redundant for such as small task.
Do I have to use recursion on the string (id_str) and increment or decrement it by one? I hate to use a hack for such as small detail that should just work.
—
If you’ve had this problem please share your solution.
thanks!
I ran into this same problem, and ended up solving it by subtracting 1 from the last digit, and then accounting for the scenario when we’re subtracting 1 from 0 via recursion.