This bot was built using NodeJS, and it simply makes a request to the Unsplash API every 2mins (using the node-schedule NPM package) to receive data on 30 images.
Why I created this bot? I created this bot to solve a problem. I needed thousands of Unsplash images each time a user wanted to have a “relaxation session” on my other project “CalmSlides”, and the Unsplash API (in development mode) restricts the number of requests I can make to 50 requests per hour (Note: in each request I can retrieve data on up to 30 images maximum) .
Hence to solve this problem I created a bot that made requests for all the image data I could need on the website beforehand, and store it on MongoDB, so I would not need to make an API call each time I needed the images on “CalmSlides”. The bot ran for 4 days, and stored data on 92,813 images, before I shut it down (temporarily).
It uses the mongoose NPM package to connect to MongoDB and store data in the database.During this project, I learned how to store data in MongoDB by creating Schemas and Models.
Key NPM Packages used: node-fetch, mongoose, node-schedule, unsplash-js, dotenv
Read on more of my projects over on my website: Adeyemo OlaOluwa