rdrview

Firefox Reader View as a command line tool
授权协议 Apache-2.0 License
开发语言 JavaScript
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 郤立果
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

rdrview

Command line tool to extract the main content from a webpage, as done by the"Reader View" feature of most modern browsers. It's intended to be used withterminal RSS readers, to make the articles more readable on web browsers suchas lynx. The code is closely adapted fromthe Firefox versionand the output is expected to be mostly equivalent.

Security

This tool is young and written in C, so it's reasonable to wonder about thepotential for memory issues. To be safe, all HTML parsing happens inside asandboxed subprocess. Seccomp is used for this purpose on Linux, Pledge onOpenBSD, and Capsicum on FreeBSD.

Usage

Linux

There are three direct dependencies: libxml2, libseccomp and libcurl.On Debian/Ubuntu, you can install the first two by running (as root):

apt install libxml2-dev libseccomp-dev

The libcurl package comes in different flavours, depending on the backend thatprovides the SSL support. Any of them will do. To install the GnuTLS version:

apt install libcurl4-gnutls-dev

For rdrview to be useful, you should also get a character mode web browsersuch as lynx:

apt install lynx

The name of the packages might differ in your distribution. On Fedora, forexample, you can install everything with:

dnf install libcurl-devel libxml2-devel libseccomp-devel lynx

To build rdrview, just cd to its directory and run

make

Now it should be ready to be used. You can try:

./rdrview 'https://github.com/eafer/rdrview'

For more information, see the man page:

man ./rdrview.1

If you find rdrview useful and want to install it, become root again and run

make install

Now you can just call it with rdrview and get help with man rdrview, likeyou would for any other tool in your system.

BSDs

To build rdrview on the BSDs, you will need GNU make as well as the libraries.Having a terminal browser available is recommended. On OpenBSD, become root andrun

pkg_add gmake curl libxml lynx

On FreeBSD, that would be

pkg install gmake gcc libxml2 curl lynx

Now you can cd to the source directory and run gmake for the build, andoptionally gmake install for the installation. The BSDs don't provide anymailcap file by default, so to run rdrview you will need to specify the webbrowser:

./rdrview -B lynx 'https://github.com/eafer/rdrview'

macOS

I don't own any Apple computers to test this myself, but I've been told thatrdrview does build on macOS. A sandbox is not yet implemented, but the toolcan still be run with the --disable-sandbox flag, as long as the userunderstands the risk.

Credits

rdrview was written byErnesto A. Fernández,but it's mainly a transpilation done by hand of Mozilla's Readability.js;which was itself, in their own words, "heavily based on Arc90'sreadability.js". This is the original license:

Copyright (c) 2010 Arc90 Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.