NOTE – If flagged as abuse, the user flagged will be blocked on your Twitter account. This script is not perfect and could flag someone who isn’t spamming.
Krebs put out in article today covering the buzz about tibet hashtags being flooded on Twitter that got me thinking. Spam accounts seem to be created within the past few days, often have a small number of followers and sometimes contain little or nothing within the tweet. Technically someone could build a quick web interface that sorts out the garbage, but that only solves half the issue as the spammers just keep plowing away.
I am not a designer and looked at this from another angle. I put together a quick python script (bare-bones) that uses the Twitter streaming API to parse through tweets, match against those characteristics and send an abuse message off to Twitter with the offending account. Simply replace the holders for username and password with your own and you are ready to go. Lastly, feel free to fork or clean up the script. I recognize this may flag real accounts, but chances are it shouldn’t.