Skip to content

LieutenantCobretti1998/Image_Scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unsplash Image Scraper

Description

The Unsplash Image Scraper is a powerful and user-friendly tool designed to download high-quality images from Unsplash based on user-specified topics, resolutions, and quantities.Description The scrape_with_api function is a custom-built scraper for fetching image URLs from Unsplash based on a given search query. It takes two arguments: the number of images to retrieve and the search term (name of the image category).

Important Note

This function does not use the official Unsplash API and is not endorsed by Unsplash. It was created for educational purposes and should be used responsibly and ethically, respecting Unsplash's terms of service. For regular and compliant use, consider using Unsplash's official API with an API key.

How It Works Input Parameters:

images_number: An integer representing the number of images you want to scrape. name: A string representing the search term or category of images. Request and Response:

The function constructs a URL to send a request to Unsplash's search endpoint. It uses custom headers to mimic a web browser request. Data Extraction:

The function processes the JSON response to extract the full image URLs and their descriptions. Return Value:

Returns a dictionary where keys are image descriptions and values are the corresponding image URLs.

Key Features

Customizable Searches: Specify the topic or theme of the images you want to download. Resolution Selection: Choose your desired resolution for the images. Quantity Control: Define the number of images you wish to scrape using the API function. Automatic Download: Images are downloaded and saved directly to your local computer.

Prerequisites

Python 3.11.4

Installation Clone the Repository:

bash Copy code git clone [URL to this repository] cd [repository name] Create a Virtual Environment (optional but recommended):

bash Copy code python -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate Install Dependencies:

bash Copy code pip install -r requirements.txt

To guide users in installing the necessary environment from an env.yml file, you should include instructions in the README.md file of your project. An env.yml file is typically used with Conda, a popular package and environment management system. Below, I'll add a section to your README.md explaining how users can install the environment from your env.yml file:


Environment Setup

This project uses Conda for managing its environment and dependencies. To set up the environment using the provided env.yml file, follow these steps:

  1. Install Conda:

  2. Create the Conda Environment:

    • Navigate to the directory containing the env.yml file.
    • Run the following command to create a Conda environment from the env.yml file:
      conda env create -f env.yml
    • This command will create a new Conda environment with the name and dependencies specified in env.yml.
  3. Activate the Environment:

    • Once the environment is created, activate it using:
      conda activate [environment_name]
    • Replace [environment_name] with the name of the environment specified in the env.yml file.
  4. Verify the Environment:

    • After activation, you can verify that the correct environment is being used by running:
      conda env list
    • The active environment will be shown with an asterisk (*).

Once the environment is set up and activated, you can proceed to run the Unsplash Image Scraper as detailed in the Usage section.


Contributing

Contributions to the Unsplash Image Scraper are welcome and appreciated. Here's how you can contribute:

Fork the Repository: Start by forking the repository to your GitHub account. Make Your Changes: Implement your changes or improvements in your forked repository. Submit a Pull Request: Open a pull request to merge your changes into the main project. Code Review: Await review and potential merging of your contributions by the project maintainers. Please adhere to the project's coding standards and guidelines when making contributions.

License

This project is licensed under the MIT License. This license permits you to use, modify, distribute, and sublicense the software, but with the original copyright and license notice intact.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages