Would anyone happen to know what the maximum user ID is on Twitter? That is by now there are about 200mil users, so would the id's range from 1 - 200million? I am finding that in that range some of the id's are not used.
开发者_StackOverflow社区I have a python script that is basically accessing the following url:
"/1/statuses/user_timeline/" + str(user_id) + ".json?count=200"
Thanks,
The Twitter API says that id
is an integer "greater than 53 bits", and that a 64 bit integer is safe to hold this value.
Nonetheless, it is recommended to use the string representation id_str
"to stay on the safe side"!?!
The Twitter API doesn't guarantee that the user_id is a monotonically increasing value. It is simply a "a permanent unique id referencing an object" (from the API docs). This means they might in the future reuse IDs (of deleted users) or even allocate the values in a semi-random fashion. The IDs might not be even assigned sequentially.
Reading too much into this value, such as signifying the number of signed up users is probably not very reliable.
No one knows that.
There were discussions on that in relation of how many users twitter really has.
There were a lot of tests as well as probing of id ranges etc.
The results were that the ids were sequentially incrementing a long time, but then had regular gaps of about 10 between them, and sometimes also seemed to be complelety random.
I don't know how accurately this information was collected, and the goal was something else, but I think you get the point.
From a technical point of view I would expect nothing else in a network as big as twitter. I am pretty sure the IDs are sharded, which means they are assigned in special reagions or servers. So that for example if your ID equals mudolo 17 I know I have to look on that very server. Or in that very country. Or something.
Or maby the server just have their own prefix or residue class for assigning ids when a new user signs up to avoid replication problems.
It is also in most cases uncommon, or "not so cool" to leak information as this. Don't ask me why, its just my esperience that comapnies want to show as least information to the outside as possible.
This includes not having an reproduceable transparanet id incremention system.
It is also vulnerable for some sort of harmful attacks, unwanted crawling, stuff like that.
So my point is.
There is no way of giving you a reliable answer. And it should not be necessary. You should design your application do deal with eveyr possible situation.
If you want to know how big you should make your database field not to get any conflicts.
I think integer should be fine for now. (even on 32 bit systems)
But always be prepared to upgrade.
Especially don't assume that it will stay numeric. Its just a unique string!
精彩评论