Permalink
Browse files

* gelbooru: parallelized

  • Loading branch information...
l29ah committed Aug 13, 2012
1 parent ff7be64 commit a70d92d1c7c4c82175d69898170f19cb8daccd89
Showing with 2 additions and 4 deletions.
  1. +2 −4 gelbooru.com/gelbooru.sh
View
@@ -2,7 +2,7 @@
# Gelbooru parser
# Download pictures from http://gelbooru.com by tags
# Usage: ./gelbooru.sh [tags] [folder for pictures (will create if unset)]
# Depends: bash, wget, xmlstarlet
# Depends: bash, wget, xmlstarlet, GNU parallel
# License: Public Domain, http://creativecommons.org/publicdomain/mark/1.0/
# Check for parameters
@@ -30,9 +30,7 @@ tags=$(echo "$1" | sed -e 's/ /%20/g')
count=$(wget -q -O - "http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=0&tags=$tags" | xmlstarlet sel -t -v /posts/@count[1])
echo "Files in query \"$1\": $count"
while [ "$count" -ge "0" ] ; do
wget -q -O - "http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&pid=$pagecount&tags=$tags" | xmlstarlet sel -t -m /posts/post/@file_url -v "." -n | while read url; do
wget -nc "$url"
done
wget -q -O - "http://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&pid=$pagecount&tags=$tags" | xmlstarlet sel -t -m /posts/post/@file_url -v "." -n | parallel --eta -j 20 wget -nc "{}"
let count=count-100
let pagecount++
done

0 comments on commit a70d92d

Please sign in to comment.