Rainbow Stream——一款适用于Linux的高级命令行Twitter客户端
Rainbow Stream是一款免费开源的Linux命令行Twitter客户端,采用MIT许可证发布。它能够显示实时的推文流,撰写推文,搜索,收藏等等。它使用Python编写,基于Twitter API和Python Twitter工具构建。要在您的控制台中运行此应用程序,您必须已安装python和pip版本2.7.x或3.x。
特性
这是一个适用于Linux命令行的免费开源Twitter客户端。
它能够在终端渲染Twitter图片。
它支持代理。
它支持交互模式。
实现了主题自定义。
它能够显示实时的Twitter流。
您可以直接在终端上发布推文、搜索和收藏推文。
在Linux中安装Rainbow Stream Twitter客户端
在安装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 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 ... .........................................................................
要检查已安装的pip版本,请使用以下命令:
$ pip --version
示例输出应如下所示:
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
要安装rainbow stream twitter客户端,请使用以下命令:
# pip install rainbowstream [For Python 2.7.x version] # pip3 install rainbowstream[For Python 3.x version]
示例输出应如下所示:
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 ....................................................................
要获取rainbowstream的帮助信息,请使用以下命令:
$ 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 Twitter客户端的使用
要使用Rainbow stream twitter客户端,请使用以下命令:
$ rainbowstream
输入上述命令后,将打开如下所示的屏幕:
使用您的凭据登录,您将获得一个PIN码。如果您已登录您的帐户,页面应显示PIN码。
将PIN码从HTTP浏览器复制到您的终端并按回车键,如下所示:
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!
您将获得如下所示的推文:
[@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
要显示趋势,请使用以下命令:
[twittername]: treand
示例输出应如下所示:
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
要获取关注者列表,请使用以下命令:
[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”。在我们的后续文章中,我们将提供更多基于Linux的技巧和提示。敬请关注!