Add an opener for `twitter:image:src' meta - 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 4d9d64f1e1d81f6701996b92db31e4a67c4dec95 (DIR) parent 68c255d1528a091fe76e8b413a60855afcb513e1 (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Sun, 16 Dec 2018 17:37:47 Add an opener for `twitter:image:src' meta (This is used by ilmanifesto.it.) Diffstat: openers/twitterogimage | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) --- diff -r 68c255d1528a -r 4d9d64f1e1d8 openers/twitterogimage --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openers/twitterogimage Sun Dec 16 17:37:47 2018 +0100 @@ -0,0 +1,8 @@ +#!/bin/sh + +for u in "$@"; do + imgurl=$(curl -gs -L "$u" | + xmllint --html --xpath 'string(//meta[@name="twitter:image:src"][1]/@content)' - 2>/dev/null | + sed -e 's/\?.*$//' -e 's/:large$//' ) + plumb "${imgurl}" +done