LP Images Downloader
A powerful Python package to effortlessly download all images from any webpage. Built with Selenium and modern Python practices, this tool automates image scraping with robust error handling and detailed logging.
✨ Features
- Dynamic Content Handling: Automatically scrolls through pages to load dynamic images
- Robust Error Handling: Comprehensive error catching and logging
- URL Validation: Ensures all images are valid before downloading
- Customizable Save Locations: Organizes downloaded images into folders based on page titles
- Detailed Logging: Provides comprehensive logging of all operations
- Type Safety: Full type hints for better code reliability
- Resource Management: Proper cleanup of browser resources
- Progress Tracking: Returns list of successfully downloaded files
📦 Installation
Install the package from PyPI using pip:
pip install LpImagesDownloader
Requirements
- Python 3.7+
- Chrome browser installed
- Internet connection
🚀 Usage/Examples
Basic Usage
from LpImagesDownloader import download_images
# Download images from a webpage, scrolling 3 times to load dynamic content
downloaded_files = download_images("https://en.wikipedia.org/wiki/India", 3)
print(f"Successfully downloaded {len(downloaded_files)} images")
Advanced Usage with Error Handling
from LpImagesDownloader import download_images
import logging
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
try:
# Download images with custom scroll count
downloaded_files = download_images("https://example.com", 5)
print(f"Successfully downloaded {len(downloaded_files)} images")
# Process downloaded files
for file_path in downloaded_files:
print(f"Downloaded: {file_path}")
except Exception as e:
logging.error(f"Failed to download images: {e}")
Sample Output
2024-03-14 10:30:15 - INFO - Setting up environment...
2024-03-14 10:30:16 - INFO - Loading URL: https://example.com
2024-03-14 10:30:17 - INFO - Running operations in the background...
2024-03-14 10:30:18 - INFO - Scrolling page 1...
2024-03-14 10:30:20 - INFO - Scrolling page 2...
2024-03-14 10:30:22 - INFO - Scrolling page 3...
2024-03-14 10:30:23 - INFO - Total detected images on page: 25
2024-03-14 10:30:24 - INFO - Downloading 1.jpg...
2024-03-14 10:30:25 - INFO - Downloading 2.jpg...
...
2024-03-14 10:30:35 - INFO - Total images downloaded: 25
2024-03-14 10:30:35 - INFO - You can view the saved images at: /path/to/Saved Images/Example
🔧 Configuration
The package uses sensible defaults but can be customized:
- Headless Mode: Browser runs in headless mode by default
- Timeout: Default page load timeout is 30 seconds
- Save Location: Images are saved in a "Saved Images" directory with subdirectories based on page titles
🛠️ Development
Setting up Development Environment
- Clone the repository:
git clone https://github.com/LpCodes/LP-All-Images-Downloader.git
cd LP-All-Images-Downloader
- Install development dependencies:
pip install -r requirements.txt
- Run tests:
python -m pytest
🧑💻 Author
Created and maintained by @LpCodes.
📜 License
This project is licensed under the MIT License. Feel free to use and modify it as needed.
🤝 Contributing
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch:
git checkout -b feature-name - Make your changes and commit them:
git commit -m 'Add feature-name' - Push to your branch:
git push origin feature-name - Open a pull request and describe your changes
Development Guidelines
- Follow PEP 8 style guide
- Add type hints to all functions
- Include docstrings for all functions
- Add tests for new features
- Update documentation as needed
🐛 Known Issues and Limitations
- Some websites may block automated browsers
- Very large pages may require more memory
- Some dynamic content may not load properly
🌟 Feedback & Suggestions
Have ideas to improve the package or documentation? Open an issue on the GitHub repository.
📝 Additional Resources
- Bug Tracker: Report Issues
- Source Code: GitHub Repository
- Documentation: Read the Docs
Thank you for using LP Images Downloader! Your feedback helps make this project better. 😊
Metadata
Release files for LpImagesDownloader 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lpimagesdownloader-1.1.0.tar.gz | 5.9 kB | Without provenance | Details for lpimagesdownloader-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| LpImagesDownloader-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for LpImagesDownloader-1.1.0-py3-none-any.whl |
Total release size: 12.3 kB
Release files / lpimagesdownloader-1.1.0.tar.gz
| Download URL | lpimagesdownloader-1.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b77f2bc0b7aa0903fd86cbfe9421180eab81c63290c4f22b7072508befccb39
|
|
BLAKE2b-256 checksum How to use checksums |
5fad4a72fe9f2d0b592743679168e3572fc945db858f4812152c501c6f304e60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.11
|
Release files / LpImagesDownloader-1.1.0-py3-none-any.whl
| Download URL | LpImagesDownloader-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
204bc14815fe96ed452b811a1bfd7e816707c8997a27ea7aac8abe01c8d86dd2
|
|
BLAKE2b-256 checksum How to use checksums |
106cdf43a21bb0fda2b0e7fa2253687da80068e6973b97727045a8ded9fc287e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.11
|
Security for LpImagesDownloader 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.