A Python application and a Flask API to scrape images from a given URL and download them to a specified directory.
🚀 Kickstart your image scraping project with this easy-to-use tool.
- Features
- Getting Started
- Flask API
- Scrape Images Route
- Standalone Script
- Example Usage
✅ Scrape images from a URL.
✅ Download images to a specified directory.
✅ Flask API to provide image scraping as a service.
To get started with this image scraper, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/web-image-scraper.git
-
Install the required packages:
pip install -r requirements.txt
-
Run the Flask API or the standalone script.
The Flask API provides a POST route for scraping images from a URL and returning the URLs of images larger than 5KB.
Endpoint: /scrape
Method: POST
Request JSON Payload:
{
"url": "https://example.com"
}Response JSON:
{
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.png"
]
}📝 Example usage:
import requests
url = 'http://localhost:5000/scrape'
data = {'url': 'https://example.com'}
response = requests.post(url, json=data)
print(response.json())The standalone script scrape_images.py allows you to scrape images from a URL and download them to a specified directory on your local system.
📝 Example usage:
python scrape_images.py