sportsbitenews / facebook-cli

:computer: Facebook command line tool

Home Page:https://asciinema.org/a/87129

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facebook CLI

Facebook functionality from the command line.

Demo

Install

gem install facebook-cli (might require sudo)

Facebook setup

To interact with the Facebook API you must create and configure a Facebook application for your personal use.

  • Go to https://developers.facebook.com/apps and click "Add a New App"
  • Go to the "Settings" tab
    • Click "Add Platform"
    • Select "Website"
    • Set "Site URL" to http://localhost
    • Add localhost to the "App Domains"
    • Click "Save Changes"
  • Go to the "App Review" tab
    • Flip the switch that says "Your app is in development and unavailable to the public."
    • Click "Confirm" to make your app live (this is required for any content you publish through this app to be visible to other users)
  • Go to the "Dashboard" tab
    • Under "App Secret" click "Show" to reveal your app secret

    • Open a terminal and save your App ID and App Secret by running:

      facebook-cli config --appid=<app-id> --appsecret=<app-secret>
      

See: detailed instructions with screenshots

Logging in

Once the Facebook app is configured, you must authorize it to access the social graph as you.

  • In a terminal, run: facebook-cli login
  • Open the given URL in a web browser, and log into your Facebook account if prompted
  • Click "Continue" to approve the permissions
  • Select the scope of your audience for any posts you publish using this application (read more)
  • Click "Ok" to continue
  • Close the browser tab

See: detailed instructions with screenshots

Run

facebook-cli login
facebook-cli me

Commands

Running facebook-cli help shows the list of available commands:

COMMANDS
    api        - Make a Facebook API request
    config     - Save your Facebook API credentials
    event      - Show event details
    events     - List your upcoming events
    feed       - List posts on your profile
    friends    - List people you are friends with (some limitations)
    help       - Shows a list of commands or help for one command
    likes      - List pages you have 'Liked'
    links      - Some useful URLs
    login      - Request Facebook permissions and receive an API access token
    logout     - Deauthorize your access token
    me         - Show your profile information
    pastevents - List your past events
    photos     - List photos you have uploaded
    photosof   - List photos you are tagged in
    post       - Post a message or image to your timeline, a page or a group
    postlink   - Post a link to your timeline, a page or a group
    postvideo  - Post a video to your timeline, a page or a group
    tagged     - List stories you are tagged in
    videos     - List videos you have uploaded
    videosof   - List videos you are tagged in

Run facebook-cli help <command> for more details on each command.

Converting output to HTML

Use a Markdown renderer to easily convert the output to an HTML document. For example, using Pandoc:

facebook-cli likes | pandoc -s -f markdown_github > likes.html

See: example

Why can't I...?

Facebook has removed a large portion of their Graph API starting with version 2.0. Niraj Shah has done a fantastic job documenting the cutbacks and their implications in these blog posts:

An article published in October, 2012 by Facebook developer Henry Zhang provides insight into the reasoning:

Post to friends wall via the API generate a high levels of negative user feedback, including “Hides” and “Mark as Spam" and so we are removing it from the API. If you want to allow people to post to their friend’s timeline from your app, you can invoke the feed dialog.

The functionality removed renders it impossible to build a full-featured interface to Facebook through the Graph API alone.

If you expand the functionality, please open a pull request.

Development

Clone this repository, then use Bundler to install Ruby dependencies:

gem install bundler
bundle install

You should now be able to run facebook-cli from the bin directory:

bin/facebook-cli

facebook-cli depends on the Koala library for interfacing with Facebook's Graph API and GLI for parsing command line arguments.

Using a ruby environment manager such as rbenv or rvm is advisable to avoid environment conflicts between projects.

Please read the guide on how to contribute.

Facebook client software in the open source community

Applications:

Libraries:

License

ISC

About

:computer: Facebook command line tool

https://asciinema.org/a/87129


Languages

Language:Ruby 100.0%