I often use DownThemAll to download content from pages, but sometimes pages that use funny links, or have pages of thumbnails breaks this great tool. Here is a script I wrote to automatically download the full size images:

base="http://bushpics.jalbum.net/Glen Davis Freshwater ck2 Jan 2015/"
ext=".jpg"
down="./images/"
webpage="index.html"

if [ ! -e $webpage ]; then
  wget "$base"
fi
if [ ! -d $down ]; then
  mkdir "$down"
fi

files=`grep -Eo "thumbs\/(\w+)\.jpg" $webpage`
#echo $files

echo "$files" | while IFS= read -r file; do
  #echo "$file"
  s=${file##*/}
  image=${s%.$ext}
  url=${base}slides\/${image}
  echo "$url"
  wget -P $down "$url"
done

## http://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bash

#You don't have to call external basename command. Instead, you could use the following commands:
#
#$ s=/the/path/foo.txt
#$ echo ${s##*/}
#foo.txt
#$ s=${s##*/}
#$ echo ${s%.txt}
#foo
#$ echo ${s%.*}
#foo
#
#(From here) even though the OP is specifically about BASH, it is important to emphasize that the above commands use the BASH #Shell Parameter Expansion and may not work in other shells.

#for f in P*; do
#    #echo "File -> $f"
#    s=${f##*/}
#    #echo ${s%.*}
#    url=${base}slides\/${s%.*}$ext
#echo $url   
##wget "$url"
#done

Advertisements