Rainbow Stream은 MIT 라이선스로 배포되는 무료 오픈소스 리눅스 명령줄(터미널)용 Twitter 클라이언트입니다. 실시간 트윗 스트림 표시, 트윗 작성, 검색, 즐겨찾기 추가 등 다양한 기능을 제공하며, Python 언어로 작성되어 Twitter API와 Python Twitter Tool을 기반으로 동작합니다. 이 프로그램을 콘솔에서 실행하려면 python과 pip(버전 2.7.x 또는 3.x)가 사전에 설치되어 있어야 합니다.
주요 기능
리눅스 명령줄 환경에서 사용할 수 있는 무료 오픈소스 Twitter 클라이언트
터미널 안에서 Twitter 이미지를 직접 렌더링할 수 있음
프록시(HTTP/SOCKS) 연결 지원
대화형(interactive) 모드 지원
테마 커스터마이징 기능 제공
실시간 Twitter 스트림 표시
터미널에서 바로 트윗 작성, 검색, 즐겨찾기 추가 가능
리눅스에 Rainbow Stream 설치하기
Rainbow Stream을 설치하기 전에, 먼저 시스템에 Python이 설치되어 있는지와 그 버전을 아래 명령어로 확인해야 합니다.
$ python --version
실행 결과는 다음과 같습니다.
Python 2.7.11+
python-pip 패키지를 설치하려면 아래 명령어를 실행하세요.
$ sudo apt-get install python-pip
설치 과정의 예시 출력은 다음과 같습니다.
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 0 upgraded, 13 newly installed, 0 to remove and 21 not upgraded. Need to get 29.7 MB of archives. Do you want to continue? [Y/n] y Fetched 29.7 MB in 19s (1,494 kB/s) Selecting previously unselected package libexpat1-dev:amd64. Unpacking libexpat1-dev:amd64 (2.1.0-7) ... ...(이하 설치 로그 생략)
설치된 pip의 버전을 확인하려면 아래 명령어를 사용합니다.
$ pip --version
실행 결과는 다음과 같습니다.
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
Rainbow Stream Twitter 클라이언트를 설치하려면 사용 중인 Python 버전에 맞는 명령어를 입력하세요.
# pip install rainbowstream [Python 2.7.x 버전인 경우] # pip3 install rainbowstream [Python 3.x 버전인 경우]
설치 과정에서 rainbowstream과 함께 의존성 패키지들(python-dateutil, arrow, requests, pyfiglet, twitter, Pillow, PySocks 등)이 자동으로 내려받아지고 빌드됩니다. 일부 환경에서는 Pillow 빌드 과정에서 오류가 발생할 수 있으므로, 이 경우 필요한 개발 라이브러리(libjpeg, zlib 등)를 먼저 설치한 후 재시도하는 것이 좋습니다.
도움말 확인하기
Rainbow Stream의 사용 가능한 옵션을 확인하려면 아래 명령어를 입력합니다.
$ rainbowstream -h
실행 결과는 다음과 같습니다.
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 사용법
Rainbow Stream을 실행하려면 아래 명령어를 입력합니다.
$ rainbowstream
명령어를 실행하면 아래와 같은 화면이 열립니다.

계정 정보로 로그인하면 PIN 번호가 발급됩니다. 이미 브라우저에서 계정에 로그인한 상태라면 바로 PIN 페이지가 표시됩니다.

웹 브라우저에 표시된 PIN 번호를 복사하여 터미널에 붙여넣고 Enter 키를 누르면 인증이 완료됩니다.
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=... 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!
인증이 완료되면 아래와 같이 타임라인의 트윗들이 실시간으로 표시됩니다.
[@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
실시간 인기 트렌드를 확인하려면 아래 명령어를 입력합니다.
[twittername]: trend
팔로워 목록을 조회하려면 아래 명령어를 사용합니다.
[twittername]: ls fl
전체 명령어 도움말을 보려면 아래처럼 입력하세요.
[twittername]: h
도움말 출력 예시는 다음과 같습니다.
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!
Rainbow Stream을 종료하려면 아래 명령어를 입력합니다.
[twittername]: q
종료 시에는 다음과 같은 메시지가 출력됩니다.
See you next time :)
마무리
이 글을 통해 우분투(Ubuntu)에서 Rainbow Stream을 설치하고 활용하는 방법을 익히셨기를 바랍니다. 참고로 Twitter(현 X)는 최근 API 정책을 여러 차례 변경했기 때문에, 최신 환경에서는 일부 기능이 정상적으로 동작하지 않을 수 있습니다. 이 경우 공식 GitHub 저장소의 최신 릴리스나 이슈를 확인해 보세요. 다음 글에서도 더 유용한 리눅스 팁과 트릭을 소개해 드리겠습니다. 계속 지켜봐 주세요!