Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # generate some helpfull information
- if [ "$1" == "help" ]; then
- echo "usage: call the script with at least 1 parameter:"
- echo "the board you want to dump"
- echo ""
- echo "the second parameter is optional and can be used"
- echo "to download the first 'x' pages (from 0 tot 15) default 0"
- echo "you can also provide all to dump them all"
- echo ""
- echo "examples:"
- echo "foo.sh p (downloads the first page of /p/)"
- echo "foo.sh p 4 (downloads page 0 through 4)"
- echo "foo.sh p all (downloads every page)"
- exit 1
- fi
- # TODO check for both arguments and default them to something if an argument is not provided
- # parse the arguments
- if [ "$1" == "" ]; then
- echo error && exit
- else
- BOARD="$1"
- fi
- if [ "$2" == "all" ]; then
- PAGES="15"
- elif [ "$2" == "" ]; then
- PAGES="15"
- else
- PAGES="$2"
- fi
- # ikno, dirty but whatevs
- if [ ! -d $BOARD ]; then
- mkdir $BOARD
- fi
- cd $BOARD
- # remove old temp files
- rm urls.tmp
- rm posts.tmp
- rm imageurls.tmp
- rm gchan.html
- # get the html file
- echo "http://www.furaffinity.net/gallery/$BOARD/" >> urls.tmp
- for (( p = 1; p <= $PAGES; p++ ))
- do
- echo "http://www.furaffinity.net/gallery/$BOARD/$p/" >> urls.tmp
- done
- wget -i urls.tmp -O gchan.html -nv
- #exit
- # parse the html file to get all the threads
- cat gchan.html | sed s/\</\\n\</g | grep '/view/' | sed 's/<a href="/http:\/\/www.furaffinity.net/' | sed 's/">//' | sort | uniq > posts.tmp
- # wget all the files and output them to 1 single file
- wget -i posts.tmp -O gchan.html -nv
- # parse all the files to get the image urls
- cat gchan.html | sed s/\</\\n\</g | grep 'Download' | sort | uniq | sed 's/<a href="'// | sed 's/"> Download//' > imageurls.tmp
- # wget ALL DEM IMAGES
- wget -i imageurls.tmp -nc
- # zip all them shit and send them via email
- #zip images.zip *
- # remove the images after being zipped, takes up a lot of space so...
- #rm images/*
- # remove temp files
- #rm urls.tmp
- #rm posts.tmp
- #rm imageurls.tmp
- #rm gchan.html
- cd ..
Advertisement
Add Comment
Please, Sign In to add comment