Share Pastebin
Guest
Public paste!

Harry

By: a guest | Sep 18th, 2009 | Syntax: Bash | Size: 1.50 KB | Hits: 153 | Expires: Never
Copy text to clipboard
  1. #!/bin/bash
  2. ## 4chan Leecher - By BenLand100, edited by Harry.
  3. ## Highly suggest you remove the echos if you are running as a cron.
  4.  
  5. echo "Welcome; collecting all thread info now."
  6.  
  7. ##begin collecting all threads and image URLs
  8. 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
  9. for ((i=1; i<=10; i++)) do
  10.     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
  11. ##end collecting all threads and image URLs
  12.  
  13. done
  14. 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
  15.  
  16. echo "Downloading all images now!"
  17.  
  18. 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.
  19.  
  20. echo "Done downloading all images; have fun!"
  21.  
  22. rm threads ##erasing the temp thread data
  23. rm images ##erasing the temp image urls