Harry
By: a guest | Sep 18th, 2009 | Syntax:
Bash | Size: 1.50 KB | Hits: 153 | Expires: Never
#!/bin/bash
## 4chan Leecher - By BenLand100, edited by Harry.
## Highly suggest you remove the echos if you are running as a cron.
echo "Welcome; collecting all thread info now."
##begin collecting all threads and image URLs
wget -U "Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.7.3) Gecko/20040916" -e robots=off -q -O- http://cgi.4chan.org/s/imgboard.html | egrep "<input type=checkbox name=\"[0-9]*\" value=delete>.*filetitle" | sed "s^.*\"\([0-9]*\)\".*^http://cgi.4chan.org/s/res/\1.html^" >> threads
for ((i=1; i<=10; i++)) do
wget -U "Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.7.3) Gecko/20040916" -e robots=off -q -O- http://cgi.4chan.org/s/$i.html | egrep "<input type=checkbox name=\"[0-9]*\" value=delete>.*filetitle" | sed "s^.*\"\([0-9]*\)\".*^http://cgi.4chan.org/s/res/\1.html^" >> threads
##end collecting all threads and image URLs
done
wget -U "Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.7.3) Gecko/20040916" -e robots=off -q -O- -i threads | egrep "<a href=\"http://cgi.4chan.org/s/src/[0-9]+.jpg\" target=\"_blank\">" | sed "s^.*\(http\://cgi.4chan.org/s/src/[0-9]*.jpg\).*^\1^" >> images ##parsing the images URLs to be downloaded
echo "Downloading all images now!"
wget -U "Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.7.3) Gecko/20040916" -e robots=off -np -c -x -q -i images ##downloading all the fookin images ..... remove -q if you want verbose information.
echo "Done downloading all images; have fun!"
rm threads ##erasing the temp thread data
rm images ##erasing the temp image urls