Command-line client for Facebook

Textbook

© Lead Image © Dietmar Wieser, fotolia.com

© Lead Image © Dietmar Wieser, fotolia.com

Article from Issue 169/2014
Author(s): , Author(s):

The Ruby-based Facy command-line client lets you display Facebook streams at the command line, as well as comment and post messages. However, getting there can be tricky.

Command-line tools for Twitter have been around for a while, and in many varieties, but users previously searched in vain for a matching Facebook tool. Now, Facy [1] takes Facebook to the command line, giving users the ability to handle typical interactions without a browser. Currently, no package is available for installing the software, so you need to install Facy from the sources hosted on GitHub. To see how this works on DEB-based distributions, check out Listing 1.

Listing 1

Install Facy

 

The next step is to create a developer account on Facebook and register the app there. To do this, visit the Facebook Developer page [2] and, in the Apps tab, select Register as a Developer. After entering your Facebook password and confirming the license agreement, a verification stage occurs during which Facebook texts you a confirmation code. After entering the code, the provider enables your account.

You should now see – again in Apps  – an entry for Create a New App. In the Add a New dialog, you will first see a prompt asking you for which platform you want to develop an app. Click on Advanced Setup here. In the new box, enter the desired Display Name and Namespace. You can choose both freely, but the namespace must contain at least seven characters without any uppercase letters.

Finally, select a Category and then confirm the entry by clicking Create Application. You will first see a Captcha query, followed by a page with two strings: the App ID and the App Secret (Figure 1). To make them visible, click Show and then enter your Facebook password again.

Figure 1: Securing the benefits of Facy involves some effort: You first need to create a developer account, then create an app, and finally authenticate the local client with the App ID and the App Secret.

You can now launch Facy by calling facy1.9. First, the software queries the App ID and then the App Secret that you just generated. Following this, Facy opens another web page in which you grant the app the necessary permissions for reading and writing (posting). Next, you change back to Facy again and confirm the prompt. The program then opens a page with the User Token and the App Token. Finally, you can copy the user token and pass it in to Facy.

Ready for Work

At this point, the software opens a connection to the Facebook servers and shows you the message stream (Figure  2). Each message starts with a unique variable in square brackets, for example [$yp]. Facy understands several commands that you pass to this variable to respond to a particular post. For example, to "like" the post identified as [$yp], you would type :like yp. An overview of all commands that Facy understands is output when you type :commands. The most important of these commands can be found in Table 1.

Figure 2: Facy showing the message stream. It takes some getting used to and is not as colorful as Facebook, but it gets the job done.

Table 1

Facy Commands

Command

Action

:post

Post entry

:like

Like post

:open

Open post in browser

:comment

Comment on post

:mailbox

Open messages

:seen

Mark a message as read

:view_img

Show photo as ASCII art

:view_comments

View comments for a post

:clear_cache

Empty the cache

:help <command>

Show help for command

:exit

Quit Facy

The :post command lets you create a new entry, and :comment lets you add a comment. Facy marks posts with photos with a {photo} tag at the end of the post.

Using :view_img <ID> (e.g., :view_img yp), the software loads the image, converts it to ASCII, and displays the results. Facy uses RMagick [3] (Ruby and ImageMagick) for this task, which explains why the software needs the libmagickwand-dev package as a dependency. The display quality shows that this is more of a gimmick, because the images are badly pixelated and distorted. Fortunately, Facy offers the opportunity to view posts in a browser at any time by typing :open <ID>.

Facy does not fare so well when it needs to handle messages: Although :mailbox opens an overview of your personal messages, we were unable to open the messages in our lab.

Conclusions

Facy is certainly not an adequate substitute for the web version of Facebook. However, if you just want to take a look at a stream, the program delivers what you need.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News