A Flask web application for searching images on Unsplash and downloading the returned results locally.
- 🔍 Search Unsplash images using a text query
- ⬇️ Download saved images directly from the browser
- 🌐 AJAX-powered search for faster page updates
- 📁 Downloads are stored locally on your machine
- 🎨 Clean responsive UI with image gallery cards
- User enters a search term on the main page
- The form submits via AJAX to the
/scrapeendpoint app.pycalls the Unsplash Search Photos API- The app downloads each returned image to
C:/Images - The gallery is rendered with download links
- Python 3.7 or higher
- A valid Unsplash API Access Key
- Windows is recommended for the default output directory (
C:/Images)
- Open a terminal and navigate to the project folder:
cd "d:\image scraper"- Install dependencies:
pip install -r requirements.txt- Visit https://unsplash.com/oauth/applications and sign in or sign up.
- Click Create a new application.
- Enter a name, description, and website URL for your app.
- Accept the Unsplash API terms and submit the application.
- Copy the Access Key from your new application details.
- Create a
.envfile in the project root. - Add your Unsplash Access Key:
UNSPLASH_ACCESS_KEY=your_actual_api_key_here
Note: This repository does not include a
.env.examplefile, so create.envmanually.
- If you use version control, add
.envto.gitignoreso your API key is not committed.
Start the Flask server:
python app.pyOpen this URL in your browser:
http://127.0.0.1:5001
- Open the app in your browser
- Enter a search keyword such as
dog,sunset, orcity - Click Scrape Images
- Wait while the app fetches and saves the images
- Click a thumbnail or Download button to download the saved image
Downloaded images are saved by default to:
C:/Images
If you want to use another folder or a different platform, change the save_dir value in app.py.
d:\image scraper\
├── app.py # Flask application and Unsplash integration
├── requirements.txt # Python dependencies
├── .env # Local environment variables (API key)
├── README.md # Project documentation
├── templates/
│ ├── index.html # Search page and AJAX form
│ └── download.html # Image gallery and download links
├── downloaded_images/ # Local folder in repo (not used by app)
└── C:/Images/ # Default runtime download folder
- Flask
- requests
- python-dotenv
- gunicorn
UNSPLASH_ACCESS_KEY— your Unsplash API access key
- Create a
.envfile in the project root - Add
UNSPLASH_ACCESS_KEY=your_actual_api_key_here - Restart the Flask app
- Verify your Access Key is correct and active
- Check your app registration on Unsplash
- Try creating a new Unsplash app if needed
- Try a broader search term
- Search for a more common topic
- Some specific queries may not return results
- Ensure
C:/Imagesexists and is writable - Run the app with sufficient permissions or change
save_dirinapp.py - Confirm your internet connection
- The app requests up to 30 results per query
- Unsplash API rate limits apply; see Unsplash developer docs for details
This project uses the Unsplash API. Refer to the Unsplash License for permitted image usage.
- Unsplash API: https://unsplash.com/developers
- This app: Use the troubleshooting section above