All pastes #1769418 Raw Edit

4chandl

public shellscript v1 · immutable
#1769418 ·published 2010-01-28 15:25 UTC
rendered paste body
#!/bin/shif [ "$1" = "" ]; then	echo "Usage: `basename $0` <4chan thread url>"	exit 1fiecho "4chan downloader"echo "Downloading untill canceled or 404'd"LOC=$(echo "$1" | egrep -o '([0-9]*)$' | sed 's/\.html//g' )echo "Downloading to $LOC"if [ ! -d $LOC ]; then	mkdir $LOCficd $LOCwhile [ "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"	#cat "$TMP2" | sed 's!/cb-nws!!g' > "$TMP"	wget -nc -i $TMP2		rm $TMP $TMP2		echo "Waiting 30 seconds befor next run"	sleep 30done;