Reducing Twitter Spam in One Swift Script


If you are on Twitter, you've probably encountered one or all of the following:
  • accounts whose tweets are the same over and over
  • accounts who only tweet links
  • receiving an @ reply that contained only a link
  • receiving a DM that came from someone who doesn't normally DM you
The first 3 cases are perfect examples of spambot behaviour. Not all, but most accounts that exhibit these behaviours are bots that want you to click a link to drive you to some garbage page where you will either be encouraged to click further or buy something you really don't want.

The last example is a phishing scam, whereby clicking on the link gives the spammer access to your username and password, and resends tweets on your behalf. So your account begins to perpetuate the scam to your own followers. You can also recognize these by the embarrassed "Oops, sorry everyone, my account's been hacked" that usually follow from the account owner. (BTW, you weren't hacked. You clicked a link ;)

So what's a tweep to do? Personally, I'd like to ask Twitter to do something to make it harder for the spambots to do their work: Write some scripts.

Twitter says spam is down. They've already prevented tweeps from tweeting the same tweet more than once (which the bots get around now by sending the same tweet via @ reply). But how about adding a filter to prevent people from tweeting links without text? And one that blocks tweets that contain a certain percentage of duplicate text compared to a tweet already sent?

Oh, I know what you're thinking. The spam bots will find a way around. And more scripts will be needed. And companies don't care about users, they care about ad dollars. But if Twitter cares about having users so they can sell ads, then unless they plan to introduce a spam-free pay-only version of Twitter, they should do all they can to keep the bots off.

Twitter wins, the advertisers win, and we win. Is that so hard? Leave your thoughts and conspiracy theories in the comments ;)