Created
March 15, 2012 08:02
-
-
Save kolen/2042843 to your computer and use it in GitHub Desktop.
Report for spam accounts with '0' name in twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Depends on tweepy | |
# easy_install tweepy | |
import tweepy | |
consumer_key="" | |
consumer_secret="" | |
access_token="" | |
access_token_secret="" | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
followers_ids = api.followers_ids() | |
print "%d followers" % len(followers_ids) | |
all_zeros = [] | |
while followers_ids: | |
chunk_ids = followers_ids[:100] | |
followers_ids = followers_ids[100:] | |
followers = api.lookup_users(user_ids=chunk_ids) | |
zeros = [f for f in followers if f.name == '0'] | |
print "Got chunk of %d followers, number of 0's: %d" % (len(chunk_ids), len(zeros)) | |
all_zeros += zeros | |
for user in all_zeros: | |
print "Reporting for spam '%s' (%s)" % (user.name, user.screen_name) | |
api.report_spam(user_id=user.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you know what is the limit of report_spam i tried several times but i couldn't find it nor detect it