elinks
elinks copied to clipboard
Integrate "reader view" via readability-cli?
I ran across this project, which uses Firefox's reader-mode functionality as a terminal app. https://gitlab.com/gardenappl/readability-cli
I think having this option as a plugin would make a lot of sites render much better.
How would I go about preprocessing html in (f)elinks with an external program? I am a web developer but unfamiliar with writing native apps. Can someone point me in the right direction?
Combining browser scripting with local CGI can do it. I tried it, but had problems with relative links. CGI script ~/cgi/read.cgi looks like this:
#!/usr/bin/python3 import os import subprocess import sys sys.stdout.write('Content-Type: text/html\r\n\r\n') sys.stdout.flush() subprocess.call(('readable', '-q', '--base', os.environ['QUERY_STRING'], '--', os.environ['QUERY_STRING']))
follow_url_hook:
def follow_url_hook(url): # in Python if url.startswith('http'): return 'file:///home/users/witekfl/cgi/read.cgi?' + url
Compile elinks with --enable-cgi and your favourite scripting backend. Enable CGI in configuration, set path for CGI scripts, so read.cgi is on it, and check.
You said to
Compile elinks with --enable-cgi and your favourite scripting backend.
Suppose my favorite scripting backend is Python. Where do I specify that? I did not see anything about that in features.conf
.
I see CONFIG_SCRIPTING_PYTHON
in configure
, but I'm not sure what to do with that.
./autogen.sh ./configure --enable-cgi --with-python (other options) make make install
Copy contrib/python/* to ~/.elinks/ and modify to your needs. python3 devel package is required.