Friday, September 4, 2009

Building a command line twitter client

Just to scratch my own itch.

I've been using twidge BUT...

- Needs me to leave my twitter password lying around in plain text config file
- Doesn't store my friends updates locally (at least for a week?)
- No easy way to RT, reply or even DM for that matter
- Doesn't display with colors (hard to read statuses)
- Doesn't display Name + Screen Name
- Not written in Ruby!

Hence I've started my own command line twitter client project using Ruby

Twitpow

Source:
http://github.com/jasonong/twitpow/tree/master

Screenshot:

Functions:
- Retrieve friend's statuses
  • - Keeps track of last status id on a ~/.twitter file
  • - Gets only statuses that are tweeted later than the last status id

# Get recent new tweets since last get
ruby twitpow.rb friends

- Retrieve a user profile

# Show profile for @jasonong
ruby twitpow.rb user jasonong


- Statuses are stored & searchable in a PStore file

# Get all stored tweets
ruby twitpow.rb history

# Get last 20 stored tweets
ruby twitpow.rb history 20

# Search for "jasonong" in stored tweets
ruby twitpow.rb history search jasonong

- Update a tweet!

# Tweeeeet!
ruby twitpow.rb update "I can haz send a tweeet!"


- Reply to friend's status

# Reply to friend's status with status_id = 31122333
ruby twitpow.rb reply 31122333

# Prompt to key in your reply
Reply to: 31122333 01:00pm Jason Ong jasonong: This is my status lah!
>> This is my reply!

# @screen_name is prepended to your reply
@jasonong This is my reply!

- Retweet a friend's status

# Retweet friend's status with status_id = 31122333
ruby twitpow.rb retweet 31122333

# Prompt to key in a message to prepend the retweet
31122333 01:00pm Jason Ong jasonong: This is my status lah!
>> Awesome my friend!

# Message and @screen_name are prepended to the retweet
Awesome my friend! RT@jasonong This is my reply!

Libraries Used:
- Httparty for REST api
- Highline for password prompt
- Term-Ansi for text color output

TODOS:
- Get replies
- Get DMs
- Get conversation threads
- Get user details
- Post updates
- Post replies
- Post retweets
- Post DMs
- Display status time
- Even better reply
- Even better retweet

No comments:

Blog Archive