All-Encompassing Trip

Hi, I’m Guillermo. This is my Tumblr. Here’s my photoblog. I'm a web developer, so if you’re interested in my work you should check out my website and my blog. You should also follow me on Twitter.

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: (↩ denotes a line wrap.)

#!/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:

gesteves$ ./fuckyou.sh agibbs1984a

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