
4chan wget grabber
By: a guest on
Apr 15th, 2012 | syntax:
Bash | size: 0.71 KB | hits: 390 | expires: Never
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage: `basename $0` <4chan thread url> <thread name>"
exit 1
fi
echo "4chan grabber//"
echo "Downloading until canceled or 404'd"
LOC=$2
echo "Downloading to $LOC"
if [ ! -d $LOC ]; then
mkdir $LOC
fi
cd $LOC
while [ "1" = "1" ]; do
TMP=`mktemp`
TMP2=`mktemp`
wget -O "$TMP" "$1"
if [ "$?" != "0" ]; then
rm $TMP $TMP2
exit 1
fi
egrep 'http://images.4chan.org/[a-z0-9]+/src/([0-9]*).(jpg|png|gif)' "$TMP" -o > "$TMP2"
wget -nc -i $TMP2
rm $TMP $TMP2
echo "Waiting 30 seconds befor next run"
sleep 30
done;