Enhanced, modular, bookmarking for newsboat, newsbeuter, or (for that matter) anything that can pass a title and an URL to a program - even from your clipboard.
Enhanced, modular, bookmarking for newsboat, newsbeuter, or (for that matter) anything that can pass a title and an URL to a program…or even from clipboard!
dangerzone
(previously called newsbeuter-dangerzone
, though it’s still in
that repo) is a modular bookmarking script for the newsboat and newsbeuter
RSS readers, but will work with anything that can spit out a string and an URL.
It doesn’t even need the string - if there is no title passed, it will determine
one from the URL.
It can also deobfuscate incoming links and optionally shorten outgoing links.
This uses (and even relies somewhat) on the ini file format used by agaetr, primarily for content warnings (for Mastodon) and for API keys, it also uses the url deobfuscating from agaetr and muna.
The urlportal script is modified from gotbletu’s script, see below.
The modular structure is specifically designed so that it should be easy to create a new module for additional services, as it relies on other programs to actually do the thing. Therefore, if one posting tool dies, another can be found and (relatively) easily swapped in without changing your whole setup.
dangerzone
is an anglicization of, well, dangerzone. (Nah, I took a GitHub
suggested repository name and it’s too late to change it now.)
This project is licensed under the MIT License. For the full license, see LICENSE
.
These are probably already installed or are easily available from your distro on linux-like distros:
You will also need:
and one of the following (or something else that is sending URLs to dangerzone
- see the GUI mode under usage):
You will (obviously) need the bookmarking apps; I’ve put together several already (that I use); obviously you can use your own. See Services Setup for details.
Download or clone the repository, and put the uncompressed files in a location of your choice. Change into that directory.
bookmark.sh
line 18 so that it matches where you put the files:export SCRIPT_DIR="$HOME/.newsboat"
newsboat
or newsbeuter
, edit your config
file with bookmark-cmd
set to the path where you put the files:# -- Bookmarks ---------------------------------------------------------
bookmark-cmd "~/.newsboat/bookmark.sh"
bookmark-interactive yes
bookmark-autopilot no
Any service you would like to use needs to have a symlink made from the “avail” directory to the “enabled” directory. For example:
ln -s $PWD/short_avail/yourls.sh $PWD/short_enabled/yourls.sh
You may use as many “out” options as you care to; choose 0 or 1 shortening services.
Using the INI file is optional if all of your binary files are on your $PATH or hand-edited in and you have no use for content warnings.
I’m adding value to the agaetr.ini file, the format is the same. The example
shows the possible options. You can leave the unused entries blank without
any difficulty (unless you’re using agaetr
, which it should work with
seamlessly). The [Feed] sections are completely ignored with dangerzone
.
After editing agaetr.ini
:
mkdir -p $HOME/.config/agaetr
cp $PWD/agaetr.ini $HOME/.config/agaetr
The services are left unbackgrounded here for maximum compatibility. And most
(except for cutycapt
or the one that saves all the HTML) only take a second.
One of the reason there are multiple different example service wrappers (and that they are written in pretty straightforward BASH scripting) is so that future users (including myself) can use them as templates or examples for other tools or new services with as little fuss as possible and without requiring a great deal of knowledge on the part of the user.
If you create one for another service, please contact me so I can merge it in (this repository is mirrored multiple places).
Murls is a free service and does not require an API key.
Go to your already functional YOURLS instance. Get the API key from
Place the URL of your instance and API key into agaetr.ini
.
yourls_api =
yourls_site =
Posts the title and URL to Twitter using Oysttyer.
Install and set up oysttyer. Place the
location of the binary into agaetr.ini
or into your $PATH.
Saves the URL to your Shaarli instance.
Install and set up the Shaarli-Client.
Make sure you set up the configuration file for the client properly. Place the
location of the binary into agaetr.ini
or into your $PATH.
Saves the article to a Wallabag instance.
Install and set up Wallabag-cli.
Place the location of the binary into agaetr.ini
or into your $PATH.
Note that shorteners and wallabag don’t get along all the time.
NOTE: Wallabag-cli after 0.5.0 doesn’t work for me…
Install and set up Todo-txt. It will add a task made up of the title and the URL.
DO NOT BACKGROUND THIS ONE
Uses mutt for sending the email, and if it finds my pplsearch address book helper. Otherwise sends to the email address specified on line 12 of the script.
It will also attach the body of the article as plain text. There are three ways demonstrated in the script (lines 21-28) itself - using lynx, using pandoc, and a horribly convoluted bespoke filter which uses hxclean and hxnormalize and hxunent from html-xml-utils, htmltidy, iconv, and sed.
The default is to use lynx
.
Uses XDG-OPEN; no configuration should be needed.
Utilizes cutycapt, if detox is in $PATH, it will be used to sanitize the title string for use as a filename. Saves in the $HOME directory.
Examples to show the different paths; this is essentially the “default” bookmarking behavior of newsbeuter/newsboat. They have almost identical formats.
While there is an official client, I wrote this using curl calls and API Keys.
You need an account there to get your own API keys. Place them into agaeter.ini
.
Install and set up toot. Place the
location of the binary into agaetr.ini
.
Install and set up youtube-dl in your $PATH. Without
editing, these scripts save audio/video into $HOME/Downloads/mp3
and $HOME/Downloads/videos
respectively.
This helper uses urlencode
(I got it from the gridsite-clients
package on Debian) on the link, then
calls sensible-browser
with the generic Facebook sharing link. User interaction is required.
Currently, content warnings are only used with Mastodon. If you do not wish
to have automatic content warnings, remove the [CW##] sections of agaetr.ini
.
If you need ideas for what tags/terms make good content warnings, the file
cwlist.txt
is included for your convenience.
Because of how matching is performed, a filter of “abuse” should catch “child abuse” and “sexual abuse”, etc. However, it matches whole words, so “war” should not catch “bloatware” or “warframe”.
The content warning system is configured in the agaetr.ini
as well:
[CW9]
keyword = social-media
matches = facebook twitter mastodon social-media online
The number after [CW
does not matter as long as they are not duplicated.
The “keyword” is what is outputted as the content warning, the space-separated
line after matches is what strings will trigger that keyword as a content
warning.
Inside newsbeuter/newsboat, press Ctrl-B (by default) to bring up the bookmarking options - it will prompt you with (pre-filled when possible) URL, title, description, and feed. Anything you add into the “description” string will be added to the title string. If no title string is passed, the program will attempt to fetch the title from the webpage.
You will then have a fzf
created interface with all the enabled “out” options
available to you. Choose as many or few as you like (press TAB to multi-select).
The individual modules are written so that they may be sourced by your other
scripts as well. The function called is [filename]_send, so inside pdf_capture
the function is pdf_capture_send
Pertinent variables are “${title}” and “${link}” .
Using GUI mode (and the clipboard support) will allow you to use this framework
with any program. If you invoke bookmark.sh -g [URL] [TITLE]
you will be
presented with a dialog to use any of the helper programs.
That is only a partial solution, though. So if you simply invoke bookmark.sh -g
without anything else, it will use xclip
to get the URL from the clipboard, then
present the GUI interface.
This means that you can bind any hotkey you like to call bookmark.sh -g
and
have it pull the URL from your clipboard, using it as a lightweight extension that
future updates can’t break.
There are other files in this repository:
unredirector.sh
- Used by agaetr
to remove redirections and shortening.
Exactly the same as muna.
urlportal.sh
- I use this as my “browser” helper. Originally from Gotbletu,
I added a few things:
Switched references to rtv to tuir
renderer.sh
- I use this for rendering articles in newsboat
. It’s the funky
bespoke method I mention above about sending mail.Steven Saus injects people with radioactivity for his day job, but only to serve the forces of good.
Mostly.