From ed3f5476c718ff469211a4b73751c32677caa1b4 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 21 May 2015 10:52:38 +0100 Subject: Add wrapper scripts to download images as appropriate for displaying webpages --- pull-images | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 pull-images (limited to 'pull-images') diff --git a/pull-images b/pull-images new file mode 100755 index 0000000..57ed567 --- /dev/null +++ b/pull-images @@ -0,0 +1,17 @@ +#!/bin/sh + +usage="Usage: $0 filename [urlroot]" + +test $# -eq 0 && echo "$usage" && exit 1 +test $# -gt 2 && echo "$usage" && exit 1 + +imgurls=`cat "$1" \ +| awk -F \( '/!\[[^\]]*\]\([^\)]*\)/ {print $2}' \ +| sed 's/)\]$//' \ +| awk '{print $1}'` + +for i in $imgurls; do + echo "$i" | grep -q '//' + test $? -ne 0 && i="${2}${i}" + wget "$i" +done -- cgit v1.2.3