Giter VIP home page Giter VIP logo

unsplash-album-downloader's Introduction

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 -

  • uploads to download all the photos uploaded by user

  • likes to download all the photos liked by user

  • collections to download all the collections of a user

  • all to download all of the above uploads, likes, collections

size takes the following values -

  • raw to download the raw size

  • full to download the full size

  • regular to download the regular size

  • small to download the small size

  • thumb to download the thumb size

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]
  • collection-id is the id of the collection

  • size is similar to above and takes the same values

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:

  • yaswanth amara-unsplash-likes-full

  • Jakob Owens-unsplash-collection-Behind The Scenes-regular

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.

unsplash-album-downloader's People

Contributors

ki3n avatar royfossil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

unsplash-album-downloader's Issues

raise JSONDecodeError("Expecting value", s, err.value) from None

Hello,
I got this error after few downloads like this :

python download_collection_album.py 445264 small

Traceback (most recent call last):
  File "download_collection_album.py", line 35, in <module>
    collection_main()
  File "download_collection_album.py", line 22, in collection_main
    get_collections(args.collection_id, args.size, args.curated)
  File "download_collection_album.py", line 12, in get_collections
    collection, s = get_response(COLLECTION_URL + cid, {'client_id': ACCESS_KEY})
  File "D:\Dev\Python\unsplash-album-downloader\download_user_album.py", line 36, in get_response
    data = json.loads(r.content.decode('utf-8'))
  File "C:\Users\ysn\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\ysn\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\ysn\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

What's the problem please ?

Hi

Duplicate of #

All photos already exists in the * folder

When issuing the command:

python download_user_album.py USERNAME collections full

Only the first folder is downloaded and the following is logged to console:

'all photos already exists in the Fatigue folder'

Expected operation:
Downloads all the collections.

Current operation:
Downloads one folder, subsequent requests to download additional items results in no change, even if additional collections are created, the same operation persists.

Hi, I am getting an error like this.

C:\Users\User>cd C:\Users\User\Desktop\unsplash-album-downloader-master

C:\Users\User\Desktop\unsplash-album-downloader-master>python download_user_album.py cherenkevich uploads raw
Traceback (most recent call last):
File "C:\Users\User\Desktop\unsplash-album-downloader-master\download_user_album.py", line 145, in
user_main()
File "C:\Users\User\Desktop\unsplash-album-downloader-master\download_user_album.py", line 133, in user_main
get_user_uploads(username, size)
File "C:\Users\User\Desktop\unsplash-album-downloader-master\download_user_album.py", line 53, in get_user_uploads
photo_ids = get_photo_ids(user_profile['links']['photos'], user_profile['total_photos'], mode)
File "C:\Users\User\Desktop\unsplash-album-downloader-master\download_user_album.py", line 88, in get_photo_ids
photos_list_response, status_code = get_response(url, payload)
File "C:\Users\User\Desktop\unsplash-album-downloader-master\download_user_album.py", line 36, in get_response
data = json.loads(r.content.decode('utf-8'))
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Unable to find endpoint

I am trying to download this collection
https://unsplash.com/wallpaper/1339090/4k-wallpapers
Unsplash doesn't provide application ID so it is confusing for me to use your tool.
So I use accessId instead, please tell me the right way.
Put it all together, here is the API i try to call:
python download_collection_album.py -c '1339090/4k-wallpapers' full
but I got: 404 error - Unable to find endpoint

/ in the Collection Titel

If the Collection Titel includes a / the makedir gets confused and throws an errror. I fixed this in the code by adding a .replace('/','') to the end of collection['title'] in the File download_collection_album.py in line 15.

Incomplete documentation

Please provide an example app_id.txt file and improved documentation on how to use APP_ID/access key.

When I run python download_collection_album.py I get the error "global name {{access key/APP_ID}} is not defined.

I have added my access key/APP_ID to both a app_id.txt file and download_collection_album.py.

Thanks

'Rate Limit Exceeded'

I keep getting the error:

Traceback (most recent call last):
  File "download_collection_album.py", line 35, in <module>
    collection_main()
  File "download_collection_album.py", line 22, in collection_main
    get_collections(args.collection_id, args.size, args.curated)
  File "download_collection_album.py", line 9, in get_collections
    collection, s = get_response(COLLECTION_URL + 'curated/' + cid, {'client_id': ACCESS_KEY})
  File "/Users/una/Documents/GitHub/unsplash-album-downloader/download_user_album.py", line 37, in get_response
    data = json.loads(r.content.decode('utf-8'))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Printing the contents of the response in download_user_album.get_response gives the message b'Rate Limit Exceeded'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.