|
I use Edbrowse all the time, including to read Hacker News. You can add custom functions into ~/.ebrc, and I have one to search for the next post on an HN page, or the "More" link, if there are no more posts on the current page. function:hnn {
/^\({} \|{More}\)
}
Edbrowse supports JavaScript, but it doesn't work very well, so I turn it off at startup, and only turn it on if I think it might make a page work better (it usually doesn't). Here's a bit of my config: # I use certifi to provide the trusted root certificate authorities
certfile=/usr/local/lib/python3.8/site-packages/certifi/cacert.pem
jar=/Users/ncarpenter/.config/edbrowse/cookiejar
downdir = /Users/ncarpenter/Downloads
# Disable cache, so each Edbrowse session doesn't cache where I've been to disk.
# It doesn't have persistent history anyways.
cachesize=0
# User agents (type ua0 for edbrowse, ua1 for Lynx, etc)
agent = Lynx/2.8.4rel.1 libwww-FM/2.14
agent = Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
agent = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3112.113 Safari/537.36
# Automatically convert Markdown, Epub, PDF to HTML
plugin {
type = markdown
desc = markdown file
suffix = md
program = pandoc --toc -f markdown %i
outtype = H
down_url
}
plugin {
type = epub
desc = epub file
suffix = epub
content = application/epub+zip
# %o is the temp output file generated by the program
program = pandoc -f epub %i
outtype = H
down_url
}
plugin {
type = pdf
desc = pdf file
suffix = pdf
content = application/pdf
# file must be local
down_url
program = pdftohtml -i -noframes %i %o >/dev/null
outtype = H
}
# Play links to audio with mpv
plugin {
type = audio
desc = streaming audio
protocol = rtsp,pnm,sdp,pls
suffix = rm,ra,ram,ogg,mp3,mp4,m3u,m3u8,opus,flac
content = audio/x-scpls,audio/mpeg,application/pls+xml
program = mpv --really-quiet --no-audio-display --no-ytdl --af=scaletempo=stride=20:overlap=1 %i
}
# Use mps-youtube to handle Youtube URLs
plugin {
type = audio/youtube
desc = streaming audio from Youtube
suffix=mpeg # Doesn't matter, but needed for edbrowse not to complain
urlmatch = .youtube.com/watch?
program = mpsyt url %i
}
# These commands run when Edbrowse starts
# See the user's guide for what these commands mean, but I'm basically setting up startup preferences
function:init {
db0
js-
sg+
ci+
dx
endm+
rl+
z37
db1
}
function:b {
b ~/.config/edbrowse/bookmarks
}
function+atb {
db0
A
,j
w+ ~/.config/edbrowse/bookmarks
^
db1
}
# Typing <hs some.domain.tld is easier than typing
# b https://some.domain.tld
function:hs {
b https://~0
}
# Because I read RFCs enough to make use of this
function+rfc {
b https://tools.ietf.org/html/rfc~1
}
# Open the current page in the default browser,
# when it just isn't working right in Edbrowse.
function+o {
db0
ub
!open "'_"
b
db1
}
# Copy the current URL to the clipboard
function:cpp {
!printf '%s' "'_" | sed ' s`^\([a-zA-Z0-9]\{1,\}://.*\)\(\.browse\)$`\1`' | tr -d '\n' | pbcopy
}
I left a few functions out, like ones to search Google and DuckDuckGo, because I store the search forms locally, but can include those in a separate comment, if anyone's interested. |
[1]: https://en.wikipedia.org/wiki/Lynx_(web_browser)