#!/bin/bash
#Choose your Board:
BOARD="wg"
echo "Getting all thread-locations from \\\\$BOARD\\\\"
for ((i=0; i<=10; i++)) do
wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8" -e robots=off -q -O- http://cgi.4chan.org/$BOARD/$i.html | grep -E "<input type=checkbox name=\\"[0-9]*\\" value=delete>.*filetitle" | sed "s^.*\\"\\([0-9]*\\)\\".*^http://cgi.4chan.org/$BOARD/res/\\1.html^" >> threadlist
echo "Threads on page " $i " added to threadlist"
done
echo "Threadlist from \\\\$BOARD\\\\ complete"
echo "------------------------------------------------------"
echo "Getting all image-locations, this can take a while"
wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8" -e robots=off -q -O- -i threadlist | grep -E "<a href=\\"http://images.4chan.org/$BOARD/src/[0-9]+.jpg\\" target=\\"_blank\\">" | sed "s^.*\\(http\\://images.4chan.org/$BOARD/src/[0-9]*.jpg\\).*^\\1^" >> imagelist
echo "Imagelist complete"
rm threadlist
echo "------------------------------------------------------"
echo "Downloading all images from \\\\$BOARD\\\\"
wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5.8" -e robots=off -np -x -nc -c -i imagelist
rm imagelist