Add an opener for nothingsuspicious - plumb - Open certain URL patterns with an ad-hoc opener (plumber)
 (HTM) hg clone https://bitbucket.org/iamleot/plumb
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) changeset c3e7062fdca26d0ccce2cd82b26cfebcc0e703de
 (DIR) parent 8cc798f52a30f31d2634f70d430c14b815d6abfa
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Tue, 11 Sep 2018 10:18:14 
       
       Add an opener for nothingsuspicious
       
       Sometimes og:image has a format of
       
        http://....squarespace.com/.../[0-9]+-+Comic.jpg
       
       ...while other times it is just:
       
        http://....squarespace.com/.../
       
       and, in the latter case the web browser is opened to display the image.
       To avoid that we can just inject a jpg filename in the latter case,
       that seems to be ignored by the server but it will permit us to
       open the image via the `image' opener.
       
       Diffstat:
        openers/nothingsuspicious |  19 +++++++++++++++++++
        1 files changed, 19 insertions(+), 0 deletions(-)
       ---
       diff -r 8cc798f52a30 -r c3e7062fdca2 openers/nothingsuspicious
       --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
       +++ b/openers/nothingsuspicious Tue Sep 11 10:18:14 2018 +0200
       @@ -0,0 +1,19 @@
       +#!/bin/sh
       +
       +for u in "$@"; do
       +       comic=$(basename "$u")
       +       imgurl=$(curl -gs -L "$u" |
       +           xmllint --html --xpath 'string(//meta[@property="og:image"][1]/@content)' - 2>/dev/null |
       +           sed -e 's/\?.*$//' )
       +       case "${imgurl}" in
       +               */*.jpg)
       +                       ;;
       +               */)
       +                       # Add a valid filename for plumb image opener, the
       +                       # website seems to ignore that and so we can do this
       +                       # kludge.
       +                       imgurl="${imgurl}${comic}.jpg"
       +                       ;;
       +       esac
       +       plumb "${imgurl}"
       +done