You see, I spend a lot of time browsing deviantART, and there are some pretty good artists whose work I like specially. So much that I sometimes feel like downloading their entire gallery! But because individually downloading 20 and so pictures is boring, I decided to make a small program to automate that for me. It works in two phases, two functions:
- getImgUrls, which pulls the images' urls from the gallery's HTML source code using a regular expression;
- downloadImgs, that, well... downloads the images one by one onto your filesystem.
As for its usage, I recommend that you import the script into another .py file and use its functions there, for the sake of modularity. Here's an example usage:
- Code: Select all
from deviantARTdownloader import getImgUrls, downloadImgs
# url is the gallery's address / core_name is used to name the images
d = getImgUrls(url="http://blueraincz.deviantart.com/gallery/", core_name="blueraincz") # getImgUrls returns a dictionary
# urlDict is a dictionary returned by getImgUrls / imgFormat is the image's format; 'jpg' is the default / path is the path to which the files will be saved
downloadImgs(urlDict=d, imgFormat='jpg', path="/home/myHome/blueraincz") # this downloads the file
Finally, the script is protected by the GNU general public license. Hence, as long as you do not violate the terms of the license, and distribute all sub-products under the GNU general public license, you can do whatever you wish this script.
WARNING: This works in version 2.7. Later versions maybe incompatible with this script.