Guest User

Wikimedia Common Image SearchResult Downloader

a guest
Jul 18th, 2012
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.34 KB | None | 0 0
  1. #!/bin/bash
  2. # ---------------------------------------------------------
  3. # WikiCommonsDongdoders
  4. # @author: gibrain.wordpress.com
  5. #
  6. # A simple script to mirror all image (full resolution)
  7. # from Wikimedia Commons Search Results.
  8. #
  9. # Usage
  10. # ./WikiCommonsDongdoders [short url]
  11. #
  12. # Examples
  13. # Download all 500 image from http://commons.wikimedia.org/w/index.php?title=
  14. # Special:Search&limit=900&offset=0&redirs=0&profile=default&search=buitenzorg
  15. #
  16. # 1. Shorten the url, ex: http://pendek.in/1ank
  17. # 2. Create new directory for download ex: mkdir ~/Buitenzorg
  18. # 3. cd ~/Buintezorg/
  19. # 4. ./WikiCommonsDongdoders http://pendek.in/1ank
  20. # 5. tail unduhan.txt and wget-log to see the download progress.
  21. #
  22. # ---------------------------------------------------------
  23.  
  24. if [ $# -lt 1 ]; then
  25.         echo 'usage: '$(basename $0)' <short url>'
  26.         #head -n 22 $(basename $0)
  27.         exit
  28. fi
  29.  
  30. echo "Start parsing the page.... (Please be patient)"
  31.  
  32. url=$1
  33.  
  34. #Parse and cleaning image url
  35. wget -q $url -O - | grep -o -P '//upload.*?jpg' | sed -e 's/\(thumb\/\)//g' |
  36.      sed -e 's/^/http:/g' > unduhan.txt
  37.  
  38. echo "Downloading...."
  39.  
  40. #Download clean url and show the status
  41. #wget -bc -i unduhan.txt | grep -o -P "wget.*\.[0-9]+" | xargs tailf
  42. wget -bc -i unduhan.txt | tailf wget-log
  43.  
  44. echo "Done !. Alhamdulillahirobbil'alamin..."
Add Comment
Please, Sign In to add comment