Who signed up for Twitter immediately before/after you?
This is just a quick hack, done in about 20 minutes in 32 lines of Python. The following script will print out the Twitter screen names of the people who signed up immediately before and after a given user.
from twitter import Api
from operator import add
from functools import partial
inc = partial(add, 1)
dec = partial(add, -1)
api = Api()
user = getUser(name)
for f, what in (dec, ‘Before:’), (inc, ‘After:’):
i = user.id
i = f(i)
u = getUser(i)
print what, u.screen_name
print ‘Could not find user %r’ % name
if __name__ == ‘__main__’:
for name in sys.argv[1:]:
I’m happy to have reached the point in my Python development where I can pretty much just type something like this in without really having to think, including the use of
The above is just a hack. Notes:
- If it can’t retrieve a user for any reason, it just assumes there is no such user.
- Twitter periodically deletes accounts of abusers, so the answer will skip those.
- Twitter had lots of early hiccups, so there may be no guarantee that user ids were actually assigned sequentially.
- This script may run forever.
- I’m using the Python Twitter library written by DeWitt Clinton. It’s been a while since it was updated, and it doesn’t give you back the time a user was created in Twitter. It would be fun to print that too.
As you were.