$ show hardikvasa/google-images-download
google-images-download is a Python application for searching and downloading images from Google Images. It functions as both a command-line tool and a library that can be imported into other Python scripts. The system uses Selenium with Chrome to handle JavaScript-heavy Google Images pages, automatically manages chromedriver via webdriver-manager, and supports extensive filtering options (size, color, format, usage rights, etc.). Key features include filename sanitization for cross-platform compatibility, metadata extraction, similar image search, and robust error handling for network issues. The architecture is monolithic with a clear separation between argument parsing, URL building, browser automation, and download execution.
The LLM identified 2 files worth highlighting for reuse:
The sanitize_filename method removes illegal characters from filenames for both Windows and Unix filesystems, handles edge cases like trailing dots and spaces, and replaces problematic characters with underscores. This isolated function solves a common cross-platform problem with no dependencies, making it safely reusable in any project requiring safe file operations.
The create_directories method builds directory structures for downloads while properly handling race conditions by checking for errno 17 (EEXIST) instead of relying on pre-existence checks. This pattern demonstrates safe filesystem practices and can be extracted with minimal modification for use in any project needing to create hierarchical directories.