Tweet from command line (TTYtter)

From Akionux-wiki
Share/Save/Bookmark
Jump to: navigation, search

Abstract

A Perl application, TTYtter enables you to tweet from command line[1].

Install

In my case, I installed by apt-get on Linux Mint 17:

sudo apt-get install ttytter

Authorization

Type ttytter:

% ttytter
trying to find cURL ... /usr/bin/curl
-- Streaming API disabled (no -dostream) (TTYtter will use REST API only)
-- no version check performed (use /vcheck, or -vcheck to check on startup)

+----------------------------------------------------------------------------+
|| WELCOME TO TTYtter: Authorize TTYtter by signing into Twitter with OAuth ||
+----------------------------------------------------------------------------+
Looks like you're starting TTYtter for the first time, and/or creating a
keyfile. Welcome to the most user-hostile, highly obfuscated, spaghetti code
infested and obscenely obscure Twitter client that's out there. You'll love it.

TTYtter generates a keyfile that contains credentials for you, including your
access tokens. This needs to be done JUST ONCE. You can take this keyfile with
you to other systems. If you revoke TTYtter's access, you must remove the
keyfile and start again with a new token. You need to do this once per account
you use with TTYtter; only one account token can be stored per keyfile. If you
have multiple accounts, use -keyf=... to specify different keyfiles. KEEP THESE
FILES SECRET.

** This wizard will overwrite /home/hoge/.ttytterkey
Press RETURN/ENTER to continue or CTRL-C NOW! to abort.


Request from http://api.twitter.com/oauth/request_token .....
. FAILED!: "SSL is required
"
unable to fetch token. here are some possible reasons:
 - root certificates are not updated (see documentation)
 - you entered your authentication information wrong
 - your computer's clock is not set correctly
 - Twitter farted

If ttytter is started at first time, it tries to authorize by OAuth. But it fails because "SSL is required."

So, retry with -ssl option:

% ttytter -ssl
-- using SSL for default URLs.
trying to find cURL ... /usr/bin/curl

+----------------------------------------------------------------------------+
|| WELCOME TO TTYtter: Authorize TTYtter by signing into Twitter with OAuth ||
+----------------------------------------------------------------------------+
Looks like you're starting TTYtter for the first time, and/or creating a
keyfile. Welcome to the most user-hostile, highly obfuscated, spaghetti code
infested and obscenely obscure Twitter client that's out there. You'll love it.

TTYtter generates a keyfile that contains credentials for you, including your
access tokens. This needs to be done JUST ONCE. You can take this keyfile with
you to other systems. If you revoke TTYtter's access, you must remove the
keyfile and start again with a new token. You need to do this once per account
you use with TTYtter; only one account token can be stored per keyfile. If you
have multiple accounts, use -keyf=... to specify different keyfiles. KEEP THESE
FILES SECRET.

** This wizard will overwrite /home/hoge/.ttytterkey
Press RETURN/ENTER to continue or CTRL-C NOW! to abort.


Request from https://api.twitter.com/oauth/request_token ... SUCCEEDED!

1. Visit, in your browser, ALL ON ONE LINE,

https://api.twitter.com/oauth/authorize?oauth_token=********************************

2. If you are not already signed in, fill in your username and password.

3. Verify that TTYtter is the requesting application, and that its permissions
are as you expect (read your timeline, see who you follow and follow new
people, update your profile, post tweets on your behalf and access your
direct messages). IF THIS IS NOT CORRECT, PRESS CTRL-C NOW!

4. Click Authorize app.

5. A PIN will appear. Enter it below.

Enter PIN> *******

Open the URL following after "1. Visit, in your browser, ALL ON ONE LINE," with browser, authorise the application and get PIN:

Enter PIN> *******

Request from https://api.twitter.com/oauth/access_token ... SUCCEEDED!
Written keyfile /home/hoge/.ttytterkey

Now, restart TTYtter to use this keyfile.
(To choose between multiple keyfiles other than the default .ttytterkey,
 tell TTYtter where the key is using -keyf=... .)

Now, you can tweet from command line.

Tweet

To tweet, use ttytter like this:

% ttytter -ssl -status="Hello World from Linux Shell #zsh"

References

  1. twitter status updates from command line (via cURL) - Unix & Linux Stack Exchange