Tweetwine
A simple but tasty Twitter agent for command line use, made for fun.
Installation
Install Tweetwine as a RubyGem from GitHub:
$ sudo gem install tuomas-tweetwine --source http://gems.github.com
The program is compatible with Ruby 1.9.1, and it requires rest_client gem to be installed. In addition, json gem is needed for Ruby 1.8.6.
Usage
In the command line, run the program by entering
$ tweetwine [options...] [command]
The program needs the user’s username and password for authentication. This information can be supplied either via a configuration file or as an option (-a USERNAME:PASSWORD) to the program. It is recommended to use the former method over the latter.
The configuration file, in ~/.tweetwine, is in YAML syntax. The program recognizes the following basic settings:
username: <your_username>
password: <your_password>
colorize: true|false
When invoking the program, the supported commands are
home-
Fetch friends’ latest statuses (the contents of the authenticated user’s home).
mentions-
Fetch latest mentions for the authenticated user.
user [name]-
Fetch a specific user’s latest statuses, identified by the argument; if given no argument, fetch the statuses of the authenticated user.
update [status]-
Send a status update, but confirm the action first before actually sending. The status update can either be given as an argument or via STDIN if no argument is given.
friends-
Fetch friends and their latest statuses.
followers-
Fetch followers and their latest statuses.
If no [command] is given, the default action is home.
For all the options, see:
$ tweetwine -h
URL shortening for status update
Before actually sending a status update, it is possible for the software to shorten the URLs in the update by using an external web service. This can be enabled via the shorten_urls key in configuration file; for example:
username: spoonman
password: withyourhands
colorize: true
shorten_urls:
enable: true
service_url: http://is.gd/create.php
method: post
url_param_name: URL
xpath_selector: //input[@id='short_url']/@value
The supported methods are get and post. The method chosen affects whether parameters are passed as URL query parameters or as payload in the HTTP request, respectively. Extra parameters can be given via extra_params key, as a hash.
The xpath_selector is needed to extract the shortened URL from the result.
The feature can be disabled by
-
not defining
shorten_urlskey in the configuration file, -
setting key
enabletofalse, or -
using the command line option
--no-url-shorten.
The use of the feature requires nokogiri gem to be installed.
Contacting
Please send feedback by email to Tuomas Kareinen < tkareine (at) gmail (dot) com >.
Legal notes
Copyright © 2009 Tuomas Kareinen. See MIT-LICENSE.txt in this directory.