Rainbow Stream – An Advanced Command-line Twitter Client for Linux


Rainbow Stream is a free and open source Twitter-consumer for Linux command-line, released under MIT License. It is competent of showing Rea ltime tweet stream, compose a tweet, search, favorite,etc.It is written in Python and built on high of Twitter API and Python Twitter Tool. To run this application in your console you must have installed python and pip version 2.7.x or 3.x.

Features

  • It is a free and open source twitter-client for Linux command-line.
  • It is capable of rendering twitter image in Terminal.
  • It supports Proxy.
  • It supports interactive mode.
  • Theme customization is implemented.
  • It has the capability of showing real-time twitter stream.
  • You can tweet, search, favorite tweets right from your terminal.

Installation of Rainbow Stream Twitter Client in Linux

Before installing Rainbow stream, you must check the version of Python if it is installed or not by using the following command –

$ python --version

The sample output should be like this –

Python 2.7.11+

To install python-pip package, use the following command –

$ sudo apt-get install python-pip 

The sample output should be like this –

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-dev python-pip-whl python-pkg-resources
  python-setuptools python-wheel python2.7-dev
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  libexpat1-dev libpython-all-dev libpython-dev libpython2.7-dev python-all python-all-dev python-dev python-pip python-pip-whl
  python-pkg-resources python-setuptools python-wheel python2.7-dev
0 upgraded, 13 newly installed, 0 to remove and 21 not upgraded.
Need to get 29.7 MB of archives.
After this operation, 45.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libexpat1-dev amd64 2.1.0-7 [115 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpython2.7-dev amd64 2.7.11-7ubuntu1 [27.8 MB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-dev amd64 2.7.11-1 [7,728 B]                                             
Get:4 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 libpython-all-dev amd64 2.7.11-1 [992 B]                                           
Get:5 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all amd64 2.7.11-1 [978 B]                                                  
Get:6 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python2.7-dev amd64 2.7.11-7ubuntu1 [280 kB]                                       
Get:7 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-dev amd64 2.7.11-1 [1,160 B]                                                
Get:8 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-all-dev amd64 2.7.11-1 [1,000 B]                                            
Get:9 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python-pip-whl all 8.1.1-2 [1,074 kB]                                          
Get:10 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python-pip all 8.1.1-2 [144 kB]                                               
Get:11 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]                                        
Get:12 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 python-setuptools all 20.7.0-1 [169 kB]                                           
Get:13 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 python-wheel all 0.29.0-1 [48.0 kB]                                           
Fetched 29.7 MB in 19s (1,494 kB/s)                                                                                                            
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database ... 178346 files and directories currently installed.)
Preparing to unpack .../libexpat1-dev_2.1.0-7_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.1.0-7) ...
Selecting previously unselected package libpython2.7-dev:amd64.
Preparing to unpack .../libpython2.7-dev_2.7.11-7ubuntu1_amd64.deb ...
.........................................................................

To check the version of installed pip, use the following command –

$ pip --version

The sample output should be like this –

pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

To install rainbow stream twitter client, use the following command –

# pip install rainbowstream 	[For Python 2.7.x version]
# pip3 install rainbowstream	[For Python 3.x version]

The sample output should be like this –

Collecting rainbowstream
  Downloading rainbowstream-1.3.3.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 619kB/s 
Collecting python-dateutil (from rainbowstream)
  Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
    100% |████████████████████████████████| 204kB 4.0MB/s 
Collecting arrow (from rainbowstream)
  Downloading arrow-0.7.0.tar.gz (75kB)
    100% |████████████████████████████████| 81kB 7.9MB/s 
Collecting requests==2.5.3 (from rainbowstream)
  Downloading requests-2.5.3-py2.py3-none-any.whl (468kB)
    100% |████████████████████████████████| 471kB 2.6MB/s 
Collecting pyfiglet (from rainbowstream)
  Downloading pyfiglet-0.7.5.tar.gz (767kB)
    100% |████████████████████████████████| 768kB 716kB/s 
Collecting twitter (from rainbowstream)
  Downloading twitter-1.17.1-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 6.7MB/s 
Collecting Pillow (from rainbowstream)
  Downloading Pillow-3.2.0.zip (10.5MB)
    100% |████████████████████████████████| 10.5MB 125kB/s 
Collecting PySocks (from rainbowstream)
  Downloading PySocks-1.5.6.tar.gz
Collecting six>=1.5 (from python-dateutil->rainbowstream)
  Downloading six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: rainbowstream, arrow, pyfiglet, Pillow, PySocks
  Running setup.py bdist_wheel for rainbowstream ... done
  Stored in directory: /home/linux/.cache/pip/wheels/ce/a6/ee/78d894d77cee1169cf0db3a9a60705fc28ddf6880cae21cd28
  Running setup.py bdist_wheel for arrow ... done
  Stored in directory: /home/linux/.cache/pip/wheels/39/9d/23/0e26a93dad0f99c2c6cc22728222ec243fc5a11313c547e98d
  Running setup.py bdist_wheel for pyfiglet ... done
  Stored in directory: /home/linux/.cache/pip/wheels/22/64/50/061d962f0938800687c7d965aec42c3c3b5344634f2242f3d8
  Running setup.py bdist_wheel for Pillow ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-HnxB6G/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpRiN63bpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/PIL
  copying PIL/PaletteFile.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/ImageDraw.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/ImtImagePlugin.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/EpsImagePlugin.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/PixarImagePlugin.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/FliImagePlugin.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/FontFile.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/_binary.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/GimpGradientFile.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/JpegPresets.py -> build/lib.linux-x86_64-2.7/PIL
  copying PIL/PyAccess.py -> build/lib.linux-x86_64-2.7/PIL
....................................................................

To get the help on rainbowstream,use the following command –

$ rainbowstream -h 

The sample output should be like this –

usage: rainbowstream [-h] [-s STREAM] [-to TIMEOUT] [-tt TRACK_KEYWORDS]
                     [-fil FILTER] [-ig IGNORE] [-iot] [-24] [-ph PROXY_HOST]
                     [-pp PROXY_PORT] [-pt PROXY_TYPE]

optional arguments:
  -h, --help            show this help message and exit
  -s STREAM, --stream STREAM
                        Default stream after program start. (Default: mine)
  -to TIMEOUT, --timeout TIMEOUT
                        Timeout for the stream (seconds).
  -tt TRACK_KEYWORDS, --track-keywords TRACK_KEYWORDS
                        Search the stream for specific text.
  -fil FILTER, --filter FILTER
                        Filter specific screen_name.
  -ig IGNORE, --ignore IGNORE
                        Ignore specific screen_name.
  -iot, --image-on-term
                        Display all image on terminal.
  -24, --color-24bit    Display images using 24bit color codes.
  -ph PROXY_HOST, --proxy-host PROXY_HOST
                        Use HTTP/SOCKS proxy for network connections.
  -pp PROXY_PORT, --proxy-port PROXY_PORT
                        HTTP/SOCKS proxy port (Default: 8080).
  -pt PROXY_TYPE, --proxy-type PROXY_TYPE
                        Proxy type (HTTP, SOCKS4, SOCKS5; Default: SOCKS5).

Rainbow Stream Twitter Client Usage

To use Rainbow stream twitter client, use the following command –

$ rainbowstream

When you enter the above command, it will open a screen as shown below –

twitter
Login with your credentials and you will get a pin. If you have already logged into your account, the page should be showing PIN.
pin

Copy the PIN from HTTP favorite web Browser into your terminal and hit return key as shown below –

You are running latest version (1.3.3)

Hi there! We're gonna get you all set up to use Rainbow Stream.

In the web browser window that opens please choose to Allow
access. Copy the PIN number that appears on the next page and paste or
type it here:

Opening: https://api.twitter.com/oauth/authorize?oauth_token=AB-78QAAAAAAXZ0wAAABVGBoQvQ

Please enter the PIN: *******

That's it! Your authorization keys have been written to /root/.rainbow_oauth.
 _    _ _   _                                       _  ___________  _____ 
| |  (_) | | |                                     | ||___  /  _  ||  _  |
| | ___| |_| |_ _   _ _ __  _ __ __ _ ___  __ _  __| |   / /| |/' || |/' |
| |/ / | __| __| | | | '_ \| '__/ _` / __|/ _` |/ _` |  / / |  /| ||  /| |
|   <| | |_| |_| |_| | |_) | | | (_| \__ \ (_| | (_| |./ /  \ |_/ /\ |_/ /
|_|\_\_|\__|\__|\__,_| .__/|_|  \__,_|___/\__,_|\__,_|\_/    \___/  \___/ 
                     | |                                                  
                     |_|                                                  

Need tips ? Type "h" and hit Enter key!

you will get the tweets as shown below –

[@kittuprasad700]: 
  Girish Johar @girishjohar 2016/04/29 10:44:34 
  ₪:0 ♥:0 id:0 via Twitter for Android 
  Right time finally ... Wishing you a Very Happy Birthday @shiekhspear 😁😁👏👍
  Zoom TV @ZoomTV 2016/04/29 10:45:03 
  ₪:0 ♥:0 id:1 via TweetDeck 
  .@BeingSalmanKhan will bring visibility to Rio Olympics says @SGanguly99 https://t.co/cfG0KnxJqW

  Rajdeep Sardesai @sardesairajdeep 2016/04/29 10:45:19 
  ₪:0 ♥:0 id:2 via Twitter for iPhone 
  Not a single minute of LS spent discussing the drought! http://scroll.in/article/807324/this-chart-shows-how-much-time-the-lok-sabha-has-spent-discussing-the-horrific-drought-none

  El Androide Libre @elandroidelibre 2016/04/29 10:45:37 
  ₪:0 ♥:0 id:3 via Buffer 
  Rick Osterloh regresa a trabajar en Google http://bit.ly/1rlKVed https://t.co/BmlMykUSmd

To display trends, use the following command –

[twittername]: treand

The sample output should be like this –

WIRED @WIRED 2016/04/29 10:47:05 
  ₪:0 ♥:0 id:4 via SocialFlow 
  This is the app you need to wrangle your millions of messengers http://bit.ly/1SU6Rcx

To get the list of followers, use the following command-

[twittername]: ls fl

To get the help, use the following command –

[twittername]: h

The sample output should be like this –

Hi boss! I'm ready to serve you right now!
  -----------------------------------------------------------------------------
  You are already on your personal stream.
  Any update from Twitter will show up immediately.
  In addition, following commands are available right now:

  ♪ Twitter help
    h discover will show help for discover commands.
    h tweets will show help for tweets commands.
    h messages will show help for messages commands.
    h friends_and_followers will show help for friends and followers commands.
    h list will show help for list commands.
    h stream will show help for stream commands.

  ♪ Smart shell
    111111 * 9 / 7 or any math expression will be evaluate by Python interpreter.
    Even cal will show the calendar for current month.

  ♪ Config 
    theme will list available theme. theme monokai will apply monokai theme immediately.
    config will list all config.
      config ASCII_ART will output current value of ASCII_ART config key.
      config TREND_MAX default will output default value of TREND_MAX config key.
      config CUSTOM_CONFIG drop will drop CUSTOM_CONFIG config key.
      config IMAGE_ON_TERM = true will set value of IMAGE_ON_TERM config key to True.

  ♪ Screening 
    h will show this help again.
    p will pause the stream.
    r will unpause the stream.
    c will clear the screen.
    v will show version info.
    q will quit.

  -----------------------------------------------------------------------------
  Have fun and hang tight! 

To quit from Rainbow Stream, use the following command –

[twittername]: q

The sample output should be like this –

See you next time :)

After this article, you will be able to understand – “How to install Rainbow Stream and usage of Rainbow Stream in Ubuntu” . In our next articles, we will come up with more Linux based tricks and tips. Keep reading!

Advertisements