[Noisebridge-discuss] Twitter "filters"

aestetix aestetix aestetix at gmail.com
Sun Feb 8 14:07:53 UTC 2009


Earlier tonight I was thinking about how Twitter basically has two modes:
send a tweet to everyone, and send a tweet to one user (direct message).
There is no concept of groups [yet], so I was trying to figure out a good
way to create my own.

Twitter's API <http://apiwiki.twitter.com> has a number of handlers you can
use for the basic functionality-- making a tweet, getting friends list, etc.
Including some things for direct messages. So I decided I could "create" a
group as an array of usernames, and then loop a curl request through the
usernames to send a "group" message, effectively making a filter.

This could be really useful if you want to partition off the people you
follow into different groups, and don't want to spend the time sending
direct announcements individually when you also don't want the whole world
to know about something. I threw together a bash script to do the basics,
I'll probably write in a few more ideas in the next couple days. Feel free
to make improvements.

Now I need to sleep.

aestetix

-- BEGIN TWITTER_FILTER.SH --
#!/bin/bash
# Twitter "filter"
# created by aestetix 2009-02-08

# current usage: ./twitter_filter.sh username password message

USERNAME=$1
PASSWORD=$2
TEXT=$3

# modify the following line to create your filter
FILTER=( 'friend1' 'friend2' 'friend3' )
FILTER_SIZE=${#FILTER[@]}

for ((i = 0;i < $FILTER_SIZE;i++)); do
    curl -u $USERNAME:$PASSWORD -d text=$TEXT -d user=${FILTER[${i}]}
http://twitter.com/direct_messages/new.xml
done

-- END TWITTER_FILTER.SH --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.noisebridge.net/pipermail/noisebridge-discuss/attachments/20090208/ed0f1454/attachment-0002.html>


More information about the Noisebridge-discuss mailing list