yash1th / unsplash-album-downloader

Download entire album of photos from Unsplash
MIT License
60 stars 13 forks source link
python python-requests python-requirements python3 rest-api unsplash unsplash-api unsplashdownloader

Unsplash Public Album Downloader

Using this script you will be able to download the entire album of a user (uploads, likes or collections) or a just collection (by specifying Collection-ID) in any size you like.

Dependencies

Make sure you have Python installed and PATH variable set.

Ubuntu

If you don't have pip for Python:

sudo apt-get install python-pip

You will need modules requests installed, which are in requirements.txt

pip install -r requirements.txt

Windows

Follow this guide to install pip and configure PATH variable. The rest is the same.

Using script

Before running the script, please assign an Access Key to ACCESS_KEY variable in the python script download_user_album.py. If you do not have one, you can create here. For downloading user albums, simply run:

python download_user_album.py [username] [albumtype] [size]

Username is mandatory and by default, if no flags are passed, the script will download all the uploads of the user (If any) in a regular size. To customize the nature of downloads, Please include following flags

albumtype takes the following values -

size takes the following values -

Example :

python download_user_album.py likes small

downloads all photos liked by user in small size.

For downloading a particular collection, simply run

python download_collection_album.py [collection-id] [curated flag] [size]

Please include a -c flag when it's a curated collection you are trying to download. For example,

python download_collection_album.py 160 -c full

downloads the collection with id #160 (which is a curated collection) in a full size. So, we have to include the -c flag.

config.ini file

You can also include the access key in config.ini file. Make sure the file is in the same location as the above scripts. Inside the config.ini file, access key should look like

[UNSPLASH]
ACCESS_KEY = <your-access-key>

Downloaded files

All the photos will be downloaded in a separate folder with the name of the user and the type of download you requested.

Example folder names:

Since there is a API limit for a public access application for Unsplash (50 requests per hour), if you are trying to download a large number of photos, you might want to run the same command again once you are out of requests. The above scripts will check the folder for the photos that were already downloaded and then will download ONLY the remaining photos.

Thanks

This program would not be possible without UNSPLASH and their awesome photographers.

I sincerely appreciate if you give necessary credit to the Photographers and Unsplash whenever you use their photos.