See Which Friends Dont Follow You Back and Vice-versa In Less Than 15 Lines of..Perl(zefonseca.com)
zefonseca.com
See Which Friends Dont Follow You Back and Vice-versa In Less Than 15 Lines of..Perl
http://zefonseca.com/blogs/zen/see-which-twitterers-don%e2%80%99t-follow-you-back-and-vice-versa-in-less-than-15-lines-ofperl/
The idea was recently demonstrated in Ruby and was neatly done in 15 lines or less(Anything familiar about the title?). It used a Ruby gem that I couldn't afford, so I had to roll out some Perls of my own.
2 comments
And in python it takes 8 lines:
import wrapper
ts = wrapper.Twitter()
user = 'scorpion032'
diff= set(ts.friends.ids(screen_name=user)) - set(ts.followers.ids(screen_name=user))
for i in diff:
try: non_fol1 = ts.users.show(id=i)
except: continue
print "%s with %d followers and %d following" %(non_fol1['name'],non_fol1['followers_count'],non_fol1['friends_count'])I can't find `wrapper` module. The relevant blog post [1] refers to `twitter` module (available via `$ easy_install twitter`)
"""Print info on twitter friends that are not following back.
"""
from twitter import Twitter
t = Twitter()
creds = dict(screen_name='scorpion032')
non_followers = set(t.friends.ids(**creds)) - set(t.followers.ids(**creds))
for id in non_followers:
user_info = t.users.show(id=id)
print "%(name)s with %(followers_count)d followers "\
"and %(friends_count)d following" % user_info
[1] http://becomingguru.com/2009/05/awesome-python-twitter-libra...