This JavaScript script provides functions to retrieve and download images from Instagram. It includes functionality to filter images based on their height and download them asynchronously.
To run this project locally, follow these steps:
- Clone the repository:
git clone https://github.com/Karl-Horning/get-instagram-images.git
- Open the project directory:
open get-instagram-images
- Locate the
image-downloader.js
file.
-
Include the JavaScript file in your HTML document.
<script src='path/to/image-downloader.js'></script>
-
Call the
downloadAllImages
function to download all images with a height greater than the specified threshold (default is 400 pixels).downloadAllImages();
- Description: Retrieves the URLs of all loaded images on the page.
- Parameters:
height
(optional): Minimum height of the image (default is 400 pixels).
- Returns: An array of image URLs or an empty array if the document or
querySelectorAll
is not available.
- Description: Extracts the filename from the given image URL.
- Parameters:
url
: The URL from which to extract the filename.
- Returns: The extracted filename or
null
if no match is found.
- Description: Downloads an image using the provided URL asynchronously.
- Parameters:
url
: The URL of the image to download.filename
(optional): The filename for the downloaded image (default is 'image.jpg').
- Description: Downloads all loaded images over a specified height on the page using the previous functions.
// Download all images with a height greater than 400 pixels
downloadAllImages();
- Ensure that your webpage allows cross-origin resource sharing (CORS) for image URLs.
Contributions are welcome! Please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and ensure that the project still works.
- Create a pull request with a clear description of your changes.
This project is licensed under the MIT License.