unsavory – get rid of those stale bookmarks!
unsavory is a little Ruby script which checks your Pinboard bookmarks for dead links (ENOENT or HTTP status code 404) and removes them. Additionally it will also inform you about links which return a status code other than 200 (OK).
$ gem install unsavory
unsavory [OPTIONS] -h, --help: show help -d, --dry-run: only log outdated links without deleting them -p, --http-proxy: specify an HTTP proxy (e.g. --http-proxy="http://webproxy:8080") -l, --log-file: location of the log file (default: ./unsavory.log)
You can start the program from the command-line like this:
It will first check if it can find the configuration file '~/.unsavory', which should have the following format:
In case this file doesn't exist, HighLine will be used to prompt for login credentials. If this gem isn't available, the script will display an error message and abort.
While running unsavory will display a progressbar and an estimated time until completion:
Enter Pinboard username: citizen428 Enter Pinboard password: ************* citizen428 has 774 bookmarks. Checking: 3% |o | ETA: 00:09:34
It will also create a logfile which contains information on deleted URLs, as well as redirects and all HTTP response codes other than 200 (OK).
If you don't want to actually delete links, please use the '–dry-run' option (also available as '-n').
Any link that returns an HTTP status code of 404 will be deleted without warning. There's no undo, use at your own risk!
# Write tests. # Use tests to clean up code. # Add option to replace links with Archive.org links # Add option to update redirects
Michael Kohl <citizen428[at]gmailcom>
Copyright © 2009-2014 Michael Kohl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.