GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - khwilo/unsplash-images-json: Fetch images from Unsplash and write the fetched images data to a JSON file

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.env-sample
.env-sample
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

unsplash-images-json

Fetch images from Unsplash and write the fetched images data to a JSON file.

Unsplash images to JSON demo

Motivation

I wanted to use a random list of specified images on a project. There are various approaches to achieve this result:

  • Manually download the images and save them to disk
  • Create a JSON file with the properties of the images

I decided to implement a simple logic where I fetch images from Unsplash and then write the image data to a JSON file. From the JSON file, I could easily consume the data. Using this process, I saved storage space since I wouldn't have to download the images.

Getting started

  1. Register as a developer on Unsplash from this link: https://unsplash.com/developers.

  2. Clone this repository:

git clone https://github.com/khwilo/unsplash-images-json.git
  1. Create a .env file and add your API access key. View the format in the .env-sample that is provided in the project root directory.

  2. Run yarn or npm install to install the project dependencies.

  3. Run yarn start or npm start to run the application.

How to use

This project has a function called fetchListOfVariousPhotos that takes two arguments: queries and transform. queries is a list of search terms. transform is a boolean value. Specifying the transform property to the equal the value true; transforms the format of the written JSON file to the following:

Property Type
id string
description string
alt_description string
imgThumb string
img string
link string
userId string
userName string
userLink string
tags [ ] string

The saved JSON file can be found in the project data directory.

TODO

  • Make this project to be a CLI app

Credits

Author: Khwilo Kabaka

About

Fetch images from Unsplash and write the fetched images data to a JSON file

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.