Radjah

get.gelbooru.sh

Jan 16th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. uag="Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729)"
  4.  
  5. dldr='aria2c --remote-time'
  6. if [ ! -d $2 ]
  7. then
  8. echo Creating $2
  9. mkdir "$2"
  10. else
  11. dldr='wget -nc'
  12. fi
  13. echo Entering $2
  14. cd "$2"
  15.  
  16. postcount=`curl -# "http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=$1&limit=1"|pcregrep -o 'posts\ count=\"[^"]+'|sed -e 's/posts\ count=//' -e 's/\"//'`
  17. echo $postcount posts
  18. rm -f get2.gelbooru.txt
  19.  
  20. let "pcount=postcount/1000"
  21.  
  22. echo $pcount
  23. echo "http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=$1&limit=1000&pid=$i"
  24. for ((i=0; i<=$pcount; i++))
  25. do
  26. curl "http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=$1&limit=1000&pid=$i" -A "$uag"|pcregrep -o -e 'file_url=[^ ]+'|sed -e 's/file_url=//g' -e 's/\"//g'  >>get2.gelbooru.txt
  27. done;
  28.  
  29. $dldr -i get2.gelbooru.txt
Advertisement
Add Comment
Please, Sign In to add comment