Guillermo Esteves's profile picture

Guillermo Esteves

Blocking and reporting Twitter spammers with a shell script

A simple shell script that blocks a Twitter spammer and sends a direct message to @spam to report it:

#!/bin/bash
curl -s -u USERNAME:PASSWORD -d "id=$1" http://twitter.com/blocks/create/$1.xml
curl -s -u USERNAME:PASSWORD -d "text=$1&user=spam" http://twitter.com/direct_messages/new.xml

Replace USERNAME and PASSWORD with your username and password, obviously. It receives a single parameter, the offending spammer’s username, like so:

$ ./fuckyou.sh agibbs1984a

My script-fu is not that strong, so if you can improve this, I’m open to suggestions.